cfhttp dns resolution

纵饮孤独 提交于 2019-12-10 17:49:55

问题


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 already 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???


回答1:


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>



回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/2007423/cfhttp-dns-resolution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!