I'm creating a Vue webpage with history mode hosted on IIS. I use URL Rewrite to route any path that doesn't resolve to a static file to my index.html file, like many many forums suggested, and the Vue does client side routing from there.
However, I'm also using Windows Authentication, and any time I go to a Vue route (that doesn't match a static file) in my browser (tested on multiple), it asks for my credentials and I enter the correct ones, but it just keeps asking me again and again for my credentials, without ever letting me in. On the other hand, when I route to a static file, I log in, and it lets me in just fine and I can then go to a Vue route because I'm already logged in.
Why is IIS URL Rewrite making my authentication repeat itself and not let me in? We've been at a bit of a loss and have had to route to static file first every time to log in.
The only thing I've found is to turn off Anonymous Authentication, and it is.
Here is my web.config with the rerouting instructions:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/500" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/Dashboard/vue/dist/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
(It reroutes to /Dashboard/vue/dist/ because that contains an index.html)
Thanks!