I am using ngnix to route traffic to proper application servers based on a cookie value. So one user always lands in a particular uptstream server.
Now I have multiple such uptsream servers. I want to send 503 for a upstream server when I am taking it down for maintenance purpose. What is the simplest way to do it?
If the application server is crashed we should get normal "could not connect to backend" error. So, I should get 503 for a upstream only when I am taking it down intentionally.
I'm assuming you want to send a 503 page rather than a 503 status code. If the former, you could add an error_page line for a particular http, server or location config block: