Can we return custom HTTP response status codes?

answered
#1

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?

#3

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: