<cfhttp/> Connection Failure

ColdFusion , Gotchas , IIS , Misc , Server and Hosting Add comments

I was working on calling a remote template via <cfhttp /> recently and was experiencing a Connection Failure Error.

Scratching my head I proceeded to inspect what was going on in my code and on the wire with Firebug. 

At first I thought I had resolved the issue when I discovered my return type was a complex value (struct) but my elation was quickly drowned by the "CTRL+F5" key combination :-(

Without any luck I decided to consult the WWW.

After a quick search I discovered that it was due to the reponse being Compressed from IIS.  Apparantly the HTTPCompression algorithm used by some versions of IIS is incompatible with ColdFusion (Java).

Workaround

The work-around was to specify additional HTTP Headers telling IIS _NOT_ to use compression for that response.  See below...

<cfhttp 
    url="http://someURL.com/svcs/targetTemplate.cfm?argument1=value1&argument2=value2" 
    method="get" 
    compression="none" 
    result="remoteCallResult" >
            
        <cfhttpparam type="header" name="Accept-Encoding" value="deflate;q=0" />
            
        <cfhttpparam type="header" name="TE" value="deflate;q=0" />

</cfhttp>

OR

<cfhttp 
    url="http://someURL.com/svcs/targetTemplate.cfm?argument1=value1&argument2=value2"
    method="get" 
    compression="none" 
    result="remoteCallResult" >
            
        <cfhttpparam type="header" name="Accept-Encoding" value="*" />
            
        <cfhttpparam type="header" name="TE" value="deflate;q=0" />

</cfhttp>

That should do the trick!

Credit and a more detailed breakdown of this can be found at Steve Erat's Blog

Bookmark and Share

1 response to “<cfhttp/> Connection Failure”

  1. sherri Says:
    Thanks so much for this solution! I've seen lots of threads and posts on this subject but yours was the first one that actually corrected my problem.

Leave a Reply

Leave this field empty:

Powered by Mango Blog. Design and Icons by N.Design Studio