0
votes

I want to use IIS8 to route traffic from ports 80/443 to two applications running on the same server - one sitting on port 8080 (node.js app, running as a separate service), another on port 8090 (a .NET application, running on the same IIS, handling api calls).

I have setup an app on port 80, with the following web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <rewrite>
              <rules>
                <rule name="rewrite api to backend calls" stopProcessing="true">
                    <match url="^api/(.+)$"/>
                    <action type="Rewrite" url="http://127.0.0.1:8080/{R:1}"/>
                 </rule>
                <rule name="rewrite everything else to frontend" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://127.0.0.1:8090/{R:1}"/>
                </rule>             
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Unfortunately this approach doesn't work - whatever resource I try to query, I get 404 error.

In the FREB logs, requests are properly translated from OldUrl, to the NewUrl, nothing is found in cache and then the following is mentioned in logs as MODULE_SET_RESPONSE_ERROR_STATUS

ModuleName="IIS Web Core", Notification="MAP_REQUEST_HANDLER", HttpStatus="404", HttpReason="Not Found", HttpSubStatus="4", ErrorCode="The filename, directory name, or volume label syntax is incorrect.
 (0x8007007b)", ConfigExceptionInfo=""
1

1 Answers

1
votes

Proxy in Application Request Routing had to be enabled as per the IIS Rewrite not working (but redirection does) topic. Issue solved :)