So I am facing this issue for quite some time and have tried multiple possible solutions, however none seem to work for me. I keep getting the gzip error. So my backend application runs off Tomcat(Tomee).
Below is my inbound Rule
<rule name="ApplicationInbound" enabled="true">
<match url="(.*)" />
<action type="Rewrite" url="https://Application:543/{R:0}" />
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="" />
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
</serverVariables>
</rule>
Outbound:
<rule name="ApplicationOutbound" preCondition="NeedsRestoringAcceptEncoding" enabled="false">
<match filterByTags="None" pattern="http(s)?://App\.domain\.local:543/(.*)" />
<action type="Rewrite" value="https://Public:543/{R:0}" />
</rule>
Precondition
<preCondition name="NeedsRestoringAcceptEncoding">
<add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
</preCondition>
<preCondition name="NeedsRestoringAcceptEncoding">
<add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
</preCondition>
Thanks in advance
Aditional info
- When I disable the outbound rule the application loads
- I have made the registry entry
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0 - this is the order of my modules Modules order
Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded ("gzip"). Status code for this is 500.52.
This is because the responses that are coming from the back-end server are using HTTP Compression, and URL rewrite cannot modify a response that is already compressed. This causes a processing error for the outbound rule resulting in the 500.52 status code.
There are two ways to work around this:
Turn off compression on the backend server that is delivering the HTTP responses (which may or may not be possible, depending on your configuration).
Attempt to indicate to the backend server the client does not accept compressed responses by removing the header when the request comes into the IIS reverse proxy and by placing it back when the response leaves the IIS server.
For the second method, we will need to add two variables named HTTP_ACCEPT_ENCODING and HTTP_X_ORIGINAL_ACCEPT_ENCODING. we will need to use these variables both in the inbound rules, to remove the Accept-Encoding header and in the Outbound Rules to place this header back again.
You can try using the following rewrite rules in web.config:
More information you can refer to this link:
https://techcommunity.microsoft.com/t5/iis-support-blog/iis-acting-as-reverse-proxy-where-the-problems-start/ba-p/846259