Click here to Skip to main content
12,757,220 members (38,382 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


Posted 25 Mar 2014

HTTP Error 500.52 (gzip compression) When Using IIS as a Reverse Proxy

, 25 Mar 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
IIS cannot rewrite gzip compressed responses from another web server, but you can prevent the response from being compressed.

When you want to run multiple web servers on port 80 and one of them is IIS, you can use URL rewriting to setup IIS as a reverse proxy. That's easy enough, you just configure the other web server to listen on a different port (e.g. 8080). Then you add a new rewrite rule in IIS, select reserve proxy and enter the external (port 80) and the internal (8080) and you're done.

However, you might run into an issue if the web server uses compression, as IIS will not be able to rewrite the compressed response:

HTTP Error 500.52 - URL Rewrite Module Error.
Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded ("gzip").

If you can disable compression, problem solved.

But maybe you cannot disable it (or don't know how). I had this issue with Octopus deploy. Maybe there is a hidden config switch to disable compression, but I didn't see any. In this case, you can use the IIS rewrite rule to override the HTTPACCEPTENCODING header before the request is delegated to the other web server.

There are only two smaller hurdles on the way:

  • The IIS Manager UI won't let you set an empty value for the header, so you have to edit it in the web.config.
  • By default, you're not allowed to set the HTTP_ACCEPT_ENCODING header, so you have to allow it. This can be done in the "Allowed Server Variables" menu, which you'll find in the side bar of the "URL Rewrite" feature ("View Server Variables...")

Without the HTTP_ACCEPT_ENCODING header allowing compressed responses, the web server should not use gzip compression and the rewrite should work just fine.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Markus Greuel
Germany Germany
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionReverse Proxy to OctopusDeploy Pin
jamgray30-Jan-15 12:10
memberjamgray30-Jan-15 12:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 25 Mar 2014
Article Copyright 2014 by Markus Greuel
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid