I am using HAproxy in front of an app that is on multiple other servers. I would like to set up a vhost in a local nginx instance that only serves a 503 for every request (to use as the 'backup' server when all backends are down). I know how to set the custom error page (as in How can I make Nginx return HTTP 503 when my proxied app server is down?) but how I can make it so that every request to nginx returns a 503?


This doesn't work?

location / {
  return 503;

There might be some tricks you have to use to get assets to show up on your custom error page (i.e., say your 503.html has an image in it. You have to do some logic to make the image show up with a 200 code, otherwise it'll be missing with a 503).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.