Andrei
Andrei

Reputation: 44700

SPA application on IIS Azure App Service

I have configured the deployment of my HTML/JS SPA to Azure App Service directly from my git repository. Works great except, there is no redirect to "/" if I open let's say "/sign-in" from the browser. Instead I see 404.

The question is, how to configure IIS to show "/index.html" if page is not found so that "what to show?" is handled on the client-side?

Upvotes: 1

Views: 725

Answers (1)

Brando Zhang
Brando Zhang

Reputation: 28432

According to your description, I suggest you could add element in the web config to allows you to configure custom error page for your Web site or application.

I suggest you could use KUDU console to local the wwwrot folder and add a web.config file as below:

<configuration>
   <system.webServer>
    <system.webServer>
    <httpErrors errorMode="Custom" existingResponse="Auto" defaultResponseMode="ExecuteURL" >
      <remove statusCode="404"/>
      <error statusCode="404" responseMode="ExecuteURL" path="/index.html" />
    </httpErrors>
  </system.webServer> 
   </system.webServer>
</configuration>

Upvotes: 1

Related Questions