locked
Outbound rules not updating 'Content-Length' header RRS feed

  • Question

  • User1406324036 posted

    A couple of months back I posted about an issue that I was having with getting the URL Rewrite module working with ColdFusion 9 when defining outbound rules (http://forums.iis.net/p/1172116/1959782.aspx). Unfortunately nobody was able to help me, so I continued researching into a potential solution.

    After much digging around in log files and examining responses using Fiddler, I found that ColdFusion passes response data to IIS with a 'Transfer-Encoding' of 'chunked'. This in itself shouldn't have caused problems for the URL Rewrite module, as I have read in various places that the module is able to handle chunked data. There is no compression (static or dynamic) enabled on the server for the site in question, so this also wasn't the issue.

    As a test, I forced ColdFusion to add a 'Content-Length' header to its response, which basically disabled chunking by telling IIS, and in turn the browser, how much data to expect. Somehow this enabled me to get outbound rules working, which suggested to me that either the module doesn't handle chunked responses correctly, or ColdFusion serves up these chunks in a way other than that expected by the module and/or IIS.

    Despite this breakthrough, this has now created another problem. When the module rewrites URLs in the page, it is leaving the 'Content-Length' header in tact and not altering the value in any way. This has the effect of correctly rewriting the URLs and serving the result to the browser, but the browser either hangs while it waits for more data or ignores any data after the length set in the header, depending on whether the result of the rewrite is shorter or longer than the original.

    For example, if I write a rule which will change an instance of 'http://www.mysite.com/test.cfm' to 'http://www.mysite.com/test', the browser will start to load the page (and in some cases display the content that the server passes) and then hang while it waits for four more bytes of data.

    Similarly, if I write a rule which changes an instance of 'http://www.mysite.com/test.cfm' to 'http://www.mysite.com/my-test-page', the browser will load the page without hanging and seems to render correctly, but when I view the source it has trimmed/ignored the last four characters of the HTML (ie. the source will end with the characters '</h', not '</html>').

    Does anyone have any idea how I can force the rewrite module to update the 'Content-Length' header with the correct value post-replacement? Alternatively, if anyone has any further insight into why the module might fail when presented with ColdFusion's idea of a chunked response, then this would also be very helpful!

    Wednesday, December 15, 2010 2:22 PM

All replies

  • User-1992149682 posted

     I have the same issue with the Content-Length not being updated after a rewrite.

    Does anyone have any ideas?

    Monday, April 18, 2011 1:19 PM
  • User-1666568250 posted

    In InetMgr you need to Server Node -> Application Request Routing Cache -> Server Proxy Settings and increase Buffer Setting.

    You will see that issue happens only when Response buffer threshold is reached.

    Wednesday, May 11, 2011 11:49 AM
  • User1355334425 posted
    Hi, I have the same issue. But unfortunately, when I set Buffer in ARR Proxy, the problem persist. When the Rewrite URL perform Outbound rules, Response Content-Length is not updated. Any idea ? please help ! Thanks.
    Wednesday, January 18, 2012 10:39 AM