Jun 14, 2006 . Comments (0)
I just ran across this issue again, CFHTTP requests to a hostname work from one Coldfusion server but not from another. The JVM caches hostname-to-IP address resolution for infinity, by default. This means that if you have a local DNS server with a host name mytest.mydomain.com and it is set to resolve to 127.0.0.1 each CFHTTP request (or CFFTP, CFLDAP, CFINVOKE) to mytest.mydomain.com after the first call will resolve to the IP 127.0.0.1. If you change the DNS entry at some point to resolve to a different IP, Coldfusion never picks up on this change, but instead continues to try and resolve to the old IP address, unless you restart Coldfusion.
You can change the caching policy by editing the networkaddress.cache.ttl value in the cf_root\runtime\jre\lib\security\java.security config file.
InetAddress Caching
The InetAddress class has a cache to store successful as well as unsuccessful host name resolutions. The positive caching is there to guard against DNS spoofing attacks; while the negative caching is used to improve performance.
By default, the result of positive host name resolutions are cached forever, because there is no general rule to decide when it is safe to remove cache entries. The result of unsuccessful host name resolution is cached for a very short period of time (10 seconds) to improve performance.
Under certain circumstances where it can be determined that DNS spoofing attacks are not possible, a Java security property can be set to a different Time-to-live (TTL) value for positive caching. Likewise, a system admin can configure a different negative caching TTL value when needed.
Two Java security properties control the TTL values used for positive and negative host name resolution caching:
- networkaddress.cache.ttl (default: -1)
- Indicates the caching policy for successful name lookups from the name service. The value is specified as as integer to indicate the number of seconds to cache the successful lookup.
A value of -1 indicates "cache forever".
- networkaddress.cache.negative.ttl (default: 10)
- Indicates the caching policy for un-successful name lookups from the name service. The value is specified as as integer to indicate the number of seconds to cache the failure for un-successful lookups.
A value of 0 indicates "never cache".
A value of -1 indicates "cache forever".
Read the TechNote from Adobe for more information.
Jun 13, 2006 . Comments (0)
As a senior developer I am constantly on the lookout for things to:
- make my life easier
- make development faster
- provide me with inspiration and ideas
- help me learn more
The
Yahoo Developer Network is a one stop shop that helps address all of those items for me. Well documented API's to a wide variety of their products and services, a
design pattern library to leverage their developer's expertise and experience, a
blog to keep up to date with what they are working on, and lots of other features I have not listed here. It's rare for a company to provide such access to parts of it's 'IP' (even Google 'the good' hasn't gone this far yet) but I'm glad they have and I'm sure their efforts to do so will help others' efforts in continuing to push the envelope of Internet development.