1

I have a website built on Angular7 with server side rendering deployed on an Azure App Service. I had to add a web.config file in order to make the server.js run. Here's the web.config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>    
    <webSocket enabled="false" />
    <handlers>    
      <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
    </handlers>
    <rewrite>
      <rules>
        <!-- Do not interfere with requests for node-inspector debugging -->
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^server.js\/debug[\/]?" />
        </rule>
        <!-- All other URLs are mapped to the node.js site entry point -->
        <rule name="DynamicContent">
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
          </conditions>
          <action type="Rewrite" url="server.js"/>
        </rule>
      </rules>
    </rewrite>    
    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin"/>
        </hiddenSegments>
      </requestFiltering>
    </security>
    <httpErrors existingResponse="PassThrough" />
    </system.webServer>
    </configuration>

This site is deployeed to mysite.com and everything works fine.

I now need to create a virtual directory mysite.com/app to hold a different application (on the old AngularJS). Without the server side rendering I just create the virtual directory on Azure Portal and everything works fine. Because of the server side and the "redirection" to server.js the virtual directory is no longer working. Is there any Rule to put on the web.config file to ignore the requests of /app, not to run the nodejs server?

NunoRibeiro
  • 511
  • 2
  • 7
  • 22

1 Answers1

0

I got my response on another question (credit to dana) so I've just added the rule

<rule name="ignore app application" stopProcessing="true">
    <match url="^app" />
    <action type="None" />
</rule>

before the other rules. This way if the url typed is mysite.com/app the node server won't be "activated" and the virtual directory works as expected.

NunoRibeiro
  • 511
  • 2
  • 7
  • 22