1

If we own www.ourdomain.com and wanted to rewrite the url to say www.google.com, how would we deal with gzip compression on say the google domain. I'm trying to do a proof of concept and i believe the issue is the website we are trying to rewite to uses gzip so IIS cant read the content? I have disabled all compression on our side. DO we need some sort of precondition?

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

    <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" />
    <rewrite>
      <outboundRules>
        <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
          <match filterByTags="A, Form, Img" pattern="https://google.com/(.*)" />
          <action type="Rewrite" value="http{R:1}://ourdomain.com/{R:2}" />
        </rule>
      </outboundRules>
      <rules>
        <rule name="ReverseProxyInboundRule1" stopProcessing="true">
          <match url="(.*)" />
          <action type="Rewrite" url="http://google.com/{R:1}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
MrBeanzy
  • 171
  • 9

1 Answers1

2

Found the answer after a lot of playing about

      <serverVariables>
        <set name="HTTP_Accept-Encoding" value="" />
      </serverVariables>
MrBeanzy
  • 171
  • 9
  • Basically you turned off compression on your backends... Outbound HTML content link rewrites are a sign of a broken design. It is usually an indicator of some workarounds. – gavenkoa Dec 04 '22 at 10:26