Welcome! Log In Create A New Profile

Advanced

Re: 503 redirect

Francis Daly
January 25, 2022 09:04AM
On Mon, Jan 24, 2022 at 04:57:02PM +0000, tony tabone wrote:

Hi there,

> I am currently trying to implement a 503 reply with specific pages. I basically have a nginx config which is using GEOIP.
>
> All the html files load fine with a 200 reply, however I am trying to change the reply to 503 and still show the same page.
>
> Is it possible for this to be done ?

I think I don't fully understand what your plan for request / response is;
but the usual way in nginx to set a "custom" response body for non-200
http responses is to use error_page: http://nginx.org/r/error_page.

Something like

error_page 503 /5xx_errors.html;

and then a "return 503;" or equivalent, might work for you?

If you have an enumerated set of uri:s that you want to return different
content to, then it might be possible to have a set of "location
=" locations, each of which sets an error_page and an appropriate
return. That might get a bit fiddly; if you can give a list of "for *this*
request I want *this* response" pairs, it might be possible to come up
with a better suggestion.

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

503 redirect

tony tabone January 24, 2022 12:02PM

Re: 503 redirect

Francis Daly January 25, 2022 09:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 74
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready