I have an IIS Server that originally hosts static HTML in wwwroot but then we decided that if a Baidu Spider tries to crawl we will map the traffic to our NuxtJS Web Server running also beside the IIS Server.
So we installed ARR (Application Request Routing) to enable the reverse proxy it is working fine and now we tried to test first where in URL Rewrite Inbound Rule:
- If Baidu Spider map the request to the NuxtJS Server (http://localhost:3000) (This is for testing first)
So with that we expect that if common users requested then it will serve the static HTML in wwwroot instead since it did not hit a rule but instead I got a 500.
TAKE NOTE:
- I am using Windows 2012 and IIS version 8.5
- if I disable my Inbound Rule then it will sure serve the static HTML Files
So do I need to create another rule? I was expecting that if it did not hit any rule the default behaviour for which it just reads in wwwroot will happen
UPDATE
- I decided to create another rule for my static HTML serving. Below is the generated rewrite rule by IIS. My problem now is that the second rule does not work. When I disable the first rule the second rule then works
<?xml version="1.0" encoding="UTF-8"?>
<rules>
<clear />
<rule name="ReverseProxyInboundRule1" enabled="true" stopProcessing="false">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:3000/{R:1}" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="^((?Baidu).)*$" />
</conditions>
</rule>
<rule name="StaticHTMLForBaiduCrawler" enabled="true" stopProcessing="false">
<match url="(.*)" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="^((?!Baidu).)*$" />
</conditions>
<action type="Rewrite" url="{R:1}/index.html" />
</rule>
</rules>