2

Im trying to set up my IIS to support push state by following these two posts. Configure IIS server to work with Aurelia framework and push state

https://gist.github.com/jdmonty/8e579b3b7c19ad80b78a

However every time I try to visit a route like localhost/app/myroute IIS thinks myroute is a static file and IIS returns a 404 with

Module  IIS Web Core
Notification    MapRequestHandler
Handler StaticFile

I found in my sites Handler Mappings theres a Static File Handler with a rule of * which I guess is handling my request because it has no extension. I tried removing the rule and tried editing the rule to *.* to force an extension but neither seemed to work. Here is my current web config rewrite rules

<rule name="Main Rule" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll">
           <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
           <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
           <add input="api.*" negate="true" />
       </conditions>
       <action type="Rewrite" url="/app/" />
 </rule>
Community
  • 1
  • 1
ThrowsException
  • 2,586
  • 20
  • 37

1 Answers1

0

I solved this using a combination of useBaseName in react router and <base href="/app"> in my index.html file.

Seemed what was happening was all the static resources in my index.html were the issue without <base href> set which was causing the rule to trigger and not give me the correct resource back.

ThrowsException
  • 2,586
  • 20
  • 37