Azure Static Websites: Navigate to routes in a SPA using URL

I and my colleagues recently developed an app with Rect that we hosting using Static Websites in Azure. When we ran the application on our development machines everything works well when we navigated to route using a URL., but when we deployed it to Azure, that stopped to work. The only thing we could do was to navigate to the root route.

When you are building a SPA application you want the application to handle all routes for you. And if we only specify an "Index document name" in the settings or the static websites, we will get back an ugly 404 page for all routes other then the root route. The reason is that Azure is trying to serve us a file with that name because it thinks we want another document than the index.html.

The solutions are to specify the index.html file as an "Error document path". When we have done so, our application can handle the routing for us!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.