Some versions of IIS may use an HTTPCompression algorithm that is incompatible with ColdFusion (or Java in general). When using CFHTTP to performthe operations GET or POSTon the target website, if the target site is using Microsoft IIS with HTTP Compression enabled, the CFHTTP tag may report a Connection Failure. If the packets are traced with Ethereal, you might even see that all the compressed data is returned to the CFHTTP tag in the response, and the status code might even be 200 OK. If you are getting a Connection Failure result, the problem is that ColdFusion doesn't know how to deflate the compressed content. If this situation occurs, then you can specify additional headers to be sent with the CFHTTP request which tell the target webserver to disable compression for that response.
[cfhttpparam type="Header" name="TE" value="deflate;q=0">
Thanks to Dan Switzer for adding a comment which suggests using an Accept-Encoding value of * instead of deflate;q-0. The * worked for me in situations where deflate did not.
2[cfhttpparam type="Header" name="TE" value="deflate;q=0">
The above headers, when used in cfhttpparam, will request that the target webserver send an uncompressed response. The headers use a q parameter to specify the quality factor as described in RFC 2616.
I couldn't reproduce this using CFMX 6.1 on Windows XP connecting to IIS 6 on Win2k3 with HTTP Compression turned on for application and static files. Not all versions ofIIS mayhave this problem, and perhaps it was fixed in recent IIS versions. In my case, I confirmed that IIS was sending compressed content by verifying that the compressed output was stored in the IIS Temporary Compressed Files directory and a packet sniff showed the compressed content as gibberish. CFHTTP was able to write out the cfhttp filecontent successfully, and reviewing that output confirmed that the content was properly deflated and readable. Here is that HTTP Request/Response from CFHTTP without using the headers described above.
Host: ps-win2k3svr1
Connection: close, TE
TE: trailers, deflate, gzip, compress
User-Agent: ColdFusion
Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
Content-Length: 192443
Content-Type: text/html
Content-Encoding: gzip
Content-Location: http://ps-win2k3svr1/serat/cgi.cfm
Last-Modified: Wed, 28 Jul 2004 14:16:51 GMT
Accept-Ranges: bytes
ETag: "80cb9f86ad74c41:4aa"
Vary: Accept-Encoding
Server: Microsoft-IIS/6.0
Date: Wed, 28 Jul 2004 14:34:26 GMT
{lots of encoded data removed here}
[cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
1[cfhttpparam type="header" name="Accept-Encoding" value="*" />
GET /serat/cgi.htm HTTP/1.1
HTTP/1.1 200 OK
Comments are not allowed for this entry.

#1 by Tony Weeg on 8/19/04 - 8:38 PM
[P]thank you for this information, you just made my night!!! i was getting the connection failure, from a site i could browse all day long from my browser. anyway, good stuff.[/P]
[P]thanks!!![/P]
#2 by Roger Benningfield on 8/26/04 - 3:55 PM
http://admin.mxblogspace.journurl.com/?mode=articl...
#3 by Josh Adams on 1/17/05 - 11:34 PM
Josh
#4 by Nelson Winters on 7/5/05 - 10:02 PM
-Nelson
#5 by John Wells on 7/13/05 - 9:05 AM
The url is an https, so I may be getting a security error instead.
Here is the code that I am using (sans url for security purposes)
Does this look right? Thanks!
#6 by John Wells on 7/13/05 - 9:15 AM
here it is with substitute chars
[CFHTTP METHOD="Get" URL="[a href="https://MyURLpath" target="_blank"]https://MyURLpath[/a]" resolveurl="yes" ]
[cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0"]
[cfhttpparam type="Header" name="TE" value="deflate;q=0"]
[/cfhttp]
thanks
#7 by David Day on 8/17/05 - 10:56 AM
#8 by dawn on 8/18/05 - 3:49 PM
I`m having some problems using cfhttp and tried out your fix here but it didnt seem to work. On our development machine we have both CF 5.5 and CFMX 7 setup as virtual machines so we can test our code in both (we are moving to MX7). I`m trying to get something working on CFMX 7 which uses cfhttp. The code I have works fine in CF 5.5 but I just get a connection failure in CFMX. In fact, I cant even run [cfhttp method="GET" url="[a href="http://www.ubc.ca/about/index.html" target="_blank"]http://www.ubc.ca/about/index.html[/a]"] on CFMX. Even that gives a connection failure. Any ideas here? Its taking about 1.5 or 2 seconds to give the error so I don`t think its timing out...
#9 by Nick Thompson on 10/19/05 - 9:42 AM
I`ve clicked on a few of your sponsor links by way of a small thanks!!
Nick
#10 by Derek T. Versteegen on 12/1/05 - 2:39 PM
I had to say that in caps cuz this solution is perfect - thank you very much!
#11 by John on 1/4/06 - 2:26 AM
Thanks again!!!!
#12 by theEye on 2/17/06 - 12:03 AM
#13 by Dan G. Switzer, II on 3/13/06 - 6:59 PM
Turns out the problem can be fixed in a number of ways:
1) When configuring httpZip, set up all compressed mime types to ignore anything with the header "ColdFusion". This will fix the issue with any default CFHTTP calls (Schedule Tasks, CFCACHE, etc.) If you`re manually setting the User Agent string, see one of the following solutions.
2) Pass in a [cfhttpparam type="header" name="Accept-Encoding" value="*" /]. For some reason Steve`s suggestion does not work, but passing in the asterisks value does work. I was never able to get a "Connection Failure" message when adding this header information.
3) The last method is to add custom header to the page serving up content, which tells the httpZip ISAPI filter to ignore compressing the request: [cfheader name="httpZip" value="no-compression" /]. For example, you could have all your CFML pages look for the custom header "Gzip-Disabled" and if the header exists and is true, you could then execute the CFHEADER tag to tell the ISAPI filter not to compress the page.
-Dan
#14 by David on 4/7/06 - 9:44 PM
#15 by Andrew on 10/20/06 - 2:58 AM
#16 by Avi on 12/5/06 - 10:15 PM
My XML API with our ecommerce vendor, after working for 2+ years broke 3 months ago, and we haven`t been able to figure it out. I am running CFMX 7 on IIS 6, and connecting to an IIS 6 server for the API. Adding the two CFHTTPPARAMs for the compression fixed the problem.
THANK YOU THANK YOU THANK YOU
#17 by James Allen on 4/22/07 - 9:45 AM
This problem is obviously something that isn`t about to go away. Using CFMX 7.1 and got the `connection failed` back when using CFHTTP to connect to a Microsoft Commerce Server website. Baffled me until I tracked down your post.
Thanks again.
#18 by Brian Kotek on 4/27/07 - 3:16 AM
#19 by James Allen on 4/27/07 - 6:15 AM
Instead of targeting the URL on a server which uses header compression, couldn`t you just call a CFM template on a different server which then executes the CFHTTP command with the relevant headers to get the compressed data to download? So your not actually using the Coldfusion schedulers CFHTTP but your own custom version.
#20 by Brian Kotek on 4/27/07 - 1:15 PM
#21 by Adrian on 5/10/07 - 2:29 PM
I have MX7 on Win 2003 and was getting "Connection Failure: Status code unavailable" and thought that since the file being picked up was xml and was gziped according to the Content encoding (by live headers plugin on firefox) that this would have been fixed with the fix mentioned here (as we have used this fix with success for something else in the past).
However this was not the case it turned out that all that was the problem was the directory given in the path attiribute of cfhttp didnt exist ...doh! A ridiculous error message for the fault really.
So watch out if the above fix didnt work for you.
#22 by Colby on 5/15/07 - 1:04 PM
A compromise solution that may work for your schedule task problem is to turn off the DEFLATE compress in IIS but leave on GZIP. Something like this will set the DEFLATE to only .dll files (the default) assuming you aren`t scheduling .dll files:
cscript.exe C:InetpubAdminScriptsadsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "dll"
#23 by Steven Erat on 1/14/10 - 11:27 AM
#24 by Rob Brooks-Bilson on 1/14/10 - 11:31 PM
[a href="http://www.brooks-bilson.com/blogs/rob/index.cfm/2...010/1/14/Bug-in-ColdFusion-801-CHF-2-and-3-with-CFHTTP-and-Compressed-HTTP-Response-from-IIS" target="_blank"]http://www.brooks-bilson.com/blogs/rob/index.cfm/2......[/a]
#25 by nickmenza on 2/9/10 - 5:51 AM
tq tq tq