Hey,
I tried to find a solution to be able to display specific Status Code Pages and also supply the correct HTTP Status Header. e.g. a Maintenance or specific Error Page with a 503 Status code.
first i tried to add the “Status” Value to the header, but Netlify accepted the header rules itself but ignored the 503 Status for the “/components/specific” route. At least i never saw it.
[{
"for": "/components/specific",
"values": {
"Status": "503 Service Temporarily Unavailable",
“Retry-After”: 300,
“X-XSS-Protection”: “1; mode=block”,
“X-Frame-Options”: “DENY”,
“X-Content-Type-Options”: “nosniff”,
“Referrer-Policy”: “no-referrer”,
“Content-Security-Policy”: “default-src * data: ‘unsafe-eval’ ‘unsafe-inline’”,
“Feature-Policy”: “camera ‘self’; fullscreen ‘self’; microphone ‘self’; speaker ‘self’; midi 'self”
}
},
{
“for”: “/*”,
“values”: {
“X-XSS-Protection”: “1; mode=block”,
“X-Frame-Options”: “DENY”,
“X-Content-Type-Options”: “nosniff”,
“Referrer-Policy”: “no-referrer”,
“Content-Security-Policy”: “default-src * data: ‘unsafe-eval’ ‘unsafe-inline’”,
“Feature-Policy”: “camera ‘self’; fullscreen ‘self’; microphone ‘self’; speaker ‘self’; midi 'self”
}
}
]
Then i tried to maybe solve it by a redirect, as i saw you could redirect with a specific status code.
If I set the “to” to “/” then the “/” path would flicker up for a millisecond and then go back tot the “from” path with a visible 503 Status Code visible in the network tab.
{
"from": "/components/specific",
"to": "/",
"status": 503,
"force": true
}
If i tried to set the redirect from to the same as the to then nothing would be happening.
{
"from": "/components/specific",
"to": "/components/specific",
"status": 503,
"force": true
},
Is there no way to defined routes where you want to have a specific Status Code Header Sent?
If not then a maintenance mode is hardly possible
you can see the results at: https://st-immospotter.netlify.app