Coldfusion CFHTTP DNS Cache Settings

Just found out after 2 hours of debugging that Coldfusion / Jrun does never refresh its DNS cache. I was trying to aggregate several RSS feeds and one feed, even though I knew it was there, was constantly throwing errors that I could not explain. Obviously that site, which was in the DNS query cache of the JVM, was moved to a new location and Coldfusion still tried to get it from the old IP. Turns out Java is setup by default to cache the DNS results forever.

In your Coldfusion directory go to runtime/jre/lib/security and open the file java.security. Now look for a line networkaddress.cache.ttl and set it to a positive integer. I set the cache TTL to 6 hours (21600s).

Restart your Coldfusion server to enable the new setting.

share