ProxyPass and chunked encoding handling?

Topics: Developer Forum, User Forum
Dec 16, 2009 at 3:06 AM

I had successfully deployed IIRF v2 with IIS 6.0 acting as SSL frontend to the backend Apache2 (XAMPP distribution) in Reverse Proxy mode.

However I experienced some troubles with dynamic PHP content served by Apache 2 and chunked encoding. Every time when I am accessing some dynamic PHP5 page with significant amount of dynamic content, it gets delivered from Apache to IIRF using chunked encoding. No bugs or errors in Apache 2, PHP or IIRF logs.. And the content coming from Apache seems to be valid (as I can access Apache running on port 8081 directly just fine). But if I try accessing the same content thru IIRF, then all browsers (I tried MSIE, FireFox and Chrome) are complaining and not displaying the page. Google Chrome tells something about the chunked encoding broken.. FireFox just doesn't display the page at all. Sorry, I have no sniffer trace since I was forwarding http to https and HttpFox just didn't print out any content at the client side at all as if connection gets reset by IIRF...

So it seems like IIRF v2.0 ProxyPass breaks the chunked encoding at some point. The workaround I had to use: buffer the entire contents of dynamic page at PHP with ob_start() / ob_get_contents, calculate the size of the output buffer and prepend an extra "Content-Length" header in PHP script itself before flushing the content to Apache.. Thus avoiding the chunked encoding to be sent by Apache to IIRF. No chunked encoding - no issue :)

Do I file it as a bug and do you need any extra information (sample contents) that gets broken by the IIRF in reverse proxy mode? I don't think it's a priority bug since I found a reasonable workaround for me, it works for me with the output buffering.. but it looks like the chunked encoding is fairly popular, it might not work well for someone else.

BTW, Thanks for the great software! It does exactly what I need.



Dec 17, 2009 at 1:37 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 17, 2009 at 1:37 AM

I filed it as a bug.

Mar 2, 2010 at 12:43 AM

Hi, I think I have a similar problem. Do you know when approximately the fix will be available?


Mar 24, 2010 at 4:52 PM

There's no support policy for IIRF; I provide fixes when I can.

At this point I think I should be able to implement chunked encoding within the next week or so. Just a guess.


Apr 16, 2010 at 1:22 PM

I posted in the work item, but I am having a problem with chunked encoding still on

I tried to setup a ProxyPass on a local test environment using:

ProxyPass            ^(.*)$  $1

and I get chunked encoding errors with chrome and Fiddler.  The IIRF logs look like it is processing the chunked data correctly and correctly reports the number of bytes as if I browse to in the browser, but Fiddler seems to get less than half of the data (ex: 7500 bytes instead of 45000 or so) when it is proxied.

Apr 17, 2010 at 11:40 AM

ok, I'll have to look at it again.

Apr 17, 2010 at 4:57 PM

ok, I tried your test case - proxying - and saw the same problem you reported.

I think I've got it fixed now, try v2.1.1.8. 


Apr 19, 2010 at 1:36 PM

v2.1.1.8 works correctly now with ProxyPass and chunked encoding.  Thanks!

Apr 19, 2010 at 2:42 PM

Thanks for the confirmation.