Home > Software engineering >  Load file based on URL regx in IIS from different document root
Load file based on URL regx in IIS from different document root

Time:07-14

Please share suggestions for below issue, How to handle an IIS URL rewrite I want to load js file from a different document root

eg localhost:80/apps/abcd.js

This file is located in a different folder path So a rule to load all /apps/(.*) from C://JSAssets/

Below rule throws 503 error


<rule name="ReverseProxyInboundRule5" stopProcessing="true">
  <match url="apps/(.*)" />
  <action type="Rewrite" url="C:\JSAssets/{R:1}" logRewrittenUrl="true" />
</rule>

Working Nginx code sample

  location /apps {
    root /var/web;
    try_files /root/assets$uri /public$uri =404;
  }

CodePudding user response:

IIS support only 1 document root. To add additional physical paths use virtual directory. https://docs.microsoft.com/en-us/iis/configuration/system.applicationhost/sites/site/application/virtualdirectory

  • Related