cfhttp dns resolution
i'm trying to get CFHTTP to talk to a domain that i have created for testing purposes on my test server. the address of the domain is "mydomain.example.com". everytime i try to connect using cfhttp i get an error stating:
Your requested host "mydomain.example.com" could not be resolved by DNS.
i have alre开发者_开发问答ady added the entry in the windows hosts file.
mydomain.example.com 127.0.0.1
i've also made sure that java.net.InetAddress can resolve the domain by doing the following in a coldfusion page:
<cfset loc.javaInet = createObject("java","java.net.InetAddress")>
<cfset loc.dnsLookup = loc.javaInet.getByName("mydomain.example.com")>
for which is get back
mydomain.example.com/127.0.0.1
i've even tried starting and stopping the coldfusion service and changing the value of networkaddress.cache.ttl in the runtime\jre\lib\security\java.security to 0.
i'm at a lost of why everything seems to be resolving at the jre level but not at the cfhttp level. any ideas???
Why is it that after I post a question, I figure it out? Go fig.
The issue was that for some reason I still had an old proxy configuration setup on my java.args line in my runtime\bin\jvm.config.
After removing the old configuration setting and restarting the ColdFusion service, I'm back in business.
For those that want to know, you can set the proxy information for cfhttp to use by adding the following arguments to your java.args line in the jvm.config file
-Dhttp.proxyHost=<ip address>
-Dhttp.proxyPort=<portnumber>
-Dhttp.proxyUser=<username>
-Dhttp.proxyPassword=<password>
Your problem may have to do with the way that DNS look-ups are cached by Coldfusion. CFHTTP permanently keeps a copy of the DNS look-up. You could try flushing this by restarting Coldfusion.
Also, your hosts file won't pick up those changes in windows easily. The easy way is with a reboot of the windows machine.
I agree, the problem is a DNS one, and using a proxy just masks the problem. Try setting your DNS resolver on Windows to something stable and public, like 8.8.8.8 which is a Google DNS server.
精彩评论