Welcome! Log In Create A New Profile

Advanced

503 redirect

tony tabone
January 24, 2022 12:02PM
Dear all,

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 ?

The below is an example of the html file.

# location of all html files that can be called.
location ~ (/static/*|/5xx_errors.html)
{
#kill cache
add_header Last-Modified $date_gmt;
#add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
add_header Cache-Control 'must-revalidate';
}

location /{
index $site_index_file ;
try_files 5xx_error.html =503;
### Condition statement to store Geo location variable and use that against the user agent to determine page to load
set $cond "${geoip2_data_country_code}";

if ($http_user_agent ~* "iphone|android") {
set $cond "${cond}X";
}

}
}

What this is doing is give a 503 error and the html file is not being shown..

Thanks & Regards,
tony
_______________________________________________
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: 307
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