9

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?

1 Answer 1

19

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).

1
  • In my case, for an endpoint server, just returning the 503 was sufficient. Thanks! May 21, 2021 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .