Using NGINX as reverse proxy for OWA
malayter at gmail.com
Wed Dec 30 22:19:42 MSK 2009
On Tue, Dec 29, 2009 at 4:45 AM, Michael Nolte - Stadt Weener (Ems)
<nolte at weener.de> wrote:
> I got the same "Content Encoding" errors. I had to add the following to
> my config:
> proxy_set_header Accept-Encoding "";
> After that it works with my (german) SBS 2003...
I have seen this same issue when using nginx to proxy to other
applications (not OWA) on IIS6 (Windows Server 2003). But, it only
happened on servers that had HTTP compression enabled for dynamic
pages, AND the "HcNoCompressionForHttp10=false" set in the metabase.
With those two settings, IIS6 replies with chunked encoding even
though the HTTP requests from nginx are http 1.0. Nginx does not
expect this, since it made an HTTP/1.0 request. So nginx then blinmdly
applies its own chunking as well when sending the response back to the
browser, resulting in "double chunking" and the content encoding error
you've seen (IE8 just gives a "page cannot be displayed" error).
This is clearly a bug and RFC violation in IIS6, it should never
return chunked encoding to an HTTP/1.0 request. I posted a comment to
this effect on TechNet's page describing the HcNoCompressionForHttp10
metabase property, but Windows 2003 is exiting mainstream support
soon, so I would not expect a fix.
I suppose it is possible those two metabase values are set to false by
default in the metabase.xml for SBS 2003, but I know those settings
are TRUE by default on a "stock" install of windows server 2003 or
2003R2. The Small Business Server stack has a lot of strange defaults
in my opinion, but this one would really surprise me, as it would
break OWA for people using most proxies (Squid, etc.)
As you discovered, setting the Accept-Encoding header to the empty
string fixes the issue, since IIS no longer tries to compress the
dynamic content, and therefore does not use chunked encoding. This is
fine if your nginx and OWA boxes have good connectivity between them,
but if they are on separate sides of a WAN link, the loss of
compression between nginx and OWA can make it quite a bit slower.
More information about the nginx