Can we return custom HTTP response status codes?

I am attempting to return a 503 HTTP response code for all pages of my site (or) perform a 302/307 redirect to a “site offline” page, which then returns a 503.

_redirects

/* /maintenance.html 307!

This successfully maps all URLs to my maintenance page, however, only 30X and 404 response codes are allowed here, it seems.

_headers

/*
  Status: 503 Service Temporarily Unavailable
  X-Frame-Options: DENY
  X-XSS-Protection: 1; mode=block
  Retry-After: 300
  cache-control: max-age=0
  cache-control: no-cache
  cache-control: no-store
  cache-control: must-revalidate

The above headers are considered valid by Netlify, however, the status of 503 is ignored. All other headers are applied to every page, except status.

Is there a way to force a 503 response code, or anything besides a 200, 30X, or 404?

Hi @dthunziker - first off, thanks for your patience! We’re currently looking into this issue as at the moment the short answer to your question is “no”, but we are intrigued by the idea of implementing this. We’ll be doing some further work, and will circle back here if anything changes.

thanks again for pointing this out - :+1:

Hi there,

I made a small demo to see if I can recreate the error, and the 503 is working for me:

https://gerald-test-503.netlify.com/503/

image

_redirects file contains:

/307/* /success 307!
/503/* /success 503!

Can you link me to the URL that was failing for you?