Reputation: 4461
I am trying to setup a reverse proxy with IIS 7.5. I want an incoming request that matches a certain URL pattern to be served by Tomcat. I have used the tutorial here to configure it.
My settings are as below:
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url=".*/(Locations|FacetedSearch|LocationPage)/.*" />
<action type="Rewrite" url="http://search.xxx.com/{R:1}" />
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="" replace="true" />
</serverVariables>
</rule>
</rules>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Form, Img" pattern="^http(s)?://search.xxx.com/(.*)" />
<action type="Rewrite" value="http{R:1}://dev.xxx.com/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
<tracing>
HTTP Error 500.52 - URL Rewrite Module Error. Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded ("deflate").
Upvotes: 8
Views: 32652
Reputation: 195
I just hit this issue as well, and I found this solution helpful: https://www.saotn.org/iis-outbound-rules-with-gzip-compression/
Basically, on inbound requests the HTTP_ACCEPT_ENCODING header gets stashed into a temporary header, and then gets restored back on the outbound rewrite rule.
In the case the link goes dead, here's the steps:
HTTP_ACCEPT_ENCODING HTTP_X_ORIGINAL_ACCEPT_ENCODING
Server Variable Name: HTTP_X_ORIGINAL_ACCEPT_ENCODING Value: {HTTP_ACCEPT_ENCODING} Server Variable Name: HTTP_ACCEPT_ENCODING Value: ""
In the case that you only need this functionality on a single site, you can add the precondition at the site-level instead of the server-level.
Upvotes: 6
Reputation: 6821
Disabling dynamic and static content compression from the site responsible for reverse proxying the requests AND the site that is being proxied fixed this error for me.
To put it in other words - if server X is routing requests to server Y, then disable dynamic and static content compression on the sites on both server X and Y.
Upvotes: 0
Reputation: 1
find "compress" in IIS,then remove the dynamic content compression and static content compression.
Upvotes: 0
Reputation: 29
Add this to your web config
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
or disable dynamic compression in iis
Upvotes: 0