Skip to content

Instantly share code, notes, and snippets.

@ozkary
Created February 26, 2022 01:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozkary/49723810f1c03d2889b6029d9d50f24d to your computer and use it in GitHub Desktop.
Save ozkary/49723810f1c03d2889b6029d9d50f24d to your computer and use it in GitHub Desktop.
Static Web Apps configuration to handle HTTP 404 errors with a fallback policy
{
"routes": [
{
"route": "/",
"allowedRoles": ["anonymous"]
},
{
"route": "/about",
"allowedRoles": ["anonymous"]
},
{
"route": "/contact-us",
"allowedRoles": ["anonymous"]
}
],
"navigationFallback": {
"rewrite": "index.html",
"exclude": ["/images/*.{png,jpg,gif}", "/css/*"]
},
"responseOverrides": {
"400": {
"rewrite": "/"
},
"401": {
"redirect": "/login",
"statusCode": 302
},
"403": {
"rewrite": "/"
},
"404": {
"rewrite": "/index.html"
}
},
"globalHeaders": {
"Content-Type": "charset=UTF-8",
"content-security-policy": "default-src https: 'self'; object-src 'none'; frame-src 'self'; img-src 'self'",
"Access-Control-Allow-Origin": "identity.azurestaticapps.net, *.azurestaticapps.net, *.google-analytics.com, *.visualstudio.com",
"X-Frame-Options": "SAMEORIGIN",
"Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"x-xss-protection": "1; mode=block",
"referrer-policy": "same-origin"
},
"mimeTypes": {
".html": "text/html",
"custom": "text/html",
".json": "text/json",
".css": "text/css",
".js": "text/javascript"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment