Based on the information you provided, it seems that you have already tried the most common solutions for configuring a custom 404 page in Azure Static Web Apps. However, there are a few more things you can try:
Make sure that the 404.html
file is included in the build output. You can check this by inspecting the contents of the out
directory after running the next build
command.
Try using an absolute path for the rewrite
property in the responseOverrides
object. For example, if your app is deployed to https://myapp.azurestaticapps.net
, you can try setting the rewrite
property to /404.html
instead of /404
.
Check the logs in the Azure portal to see if there are any errors related to the custom 404 page. You can access the logs by going to your Static Web App resource in the Azure portal, selecting "Functions", and then selecting "Logs".
- Try using the
navigationFallback
property instead ofresponseOverrides
. ThenavigationFallback
property allows you to specify a fallback page for all requests that do not match a static file or API route. Here's an example configuration:
{
"navigationFallback": {
"rewrite": "/404.html"
}
}