0

URL rewrite was working perfectly on Windows Server 2008, but I'm getting 404 errors when using the same configuration on Server 2012

    <rewrite>
        <outboundRules>
            <rule name="persist example.org" preCondition="ResponseIsHtml1" enabled="false">
                <match filterByTags="A, Form, Img" pattern="^http(s)?://10.10.10.3:8000/(.*)" />
                <action type="Rewrite" value="http{R:1}://example.org/{R:2}" />
            </rule>
            <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                <match filterByTags="A, Form, Img" pattern="^http(s)?://10.10.10.3:8080/(.*)" />
                <action type="Rewrite" value="http{R:1}://example.org/{R:2}" />
            </rule>
            <preConditions>
                <preCondition name="ResponseIsHtml1">
                    <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                </preCondition>
            </preConditions>
        </outboundRules>
        <rules>
            <rule name="RequestBlockingRule1" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="prefs?.*" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                </conditions>
                <action type="AbortRequest" />
            </rule>
            <rule name="block EDITING of example.org/library/sections" enabled="true" stopProcessing="true">
                <match url="^\/*library\/*sections" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{REQUEST_METHOD}" pattern="^DELETE$" />
                    <add input="{HTTP_HOST}" pattern="^example\.org$" />
                </conditions>
                <action type="AbortRequest" />
            </rule>
            <rule name="block browsing API on example.org" enabled="true" stopProcessing="true">
                <match url="^\/*services\/*browse" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTP_HOST}" pattern="^example\.org$" />
                </conditions>
                <action type="AbortRequest" />
            </rule>
            <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                <action type="Rewrite" url="http://10.10.10.3:8080/{R:1}" />
            </rule>
        </rules>
    </rewrite>

On Server 2012 I'm using the default IIS 8.5 server role, I installed URL Rewrite Module 2 and left all other settings default. I tried manually recreating the rules through IIS 8.5 on the 2012 server. I tried setting the Application Pool Managed Pipeline mode to "Classic". I always get "404 - File or directory not found." when navigating to "example.org" or the local IP equivalent. I'm about to give up and continue using Server 2008. Any suggestions?

Jesse Adam
  • 101
  • 3

1 Answers1

0

Figure it out, I didn't realize that the GUI updates: c:\Windows\System32\inetsrv\config\applicationHost.config

Once I added the following piece to that file on the Win2012 machine, it began working as expected.

<system.webServer>
    <proxy enabled="true" />
</system.webServer>

Silly me, I thought an inbound rewrite rule to an external host would imply the need for a reverse proxy, IIS Manager should at least warn users when proxy is disabled - I can't find this setting anywhere in the GUI.

Jesse Adam
  • 101
  • 3