503 redirect

tony tabone tony_tabone at hotmail.com
Mon Jan 24 16:57:02 UTC 2022


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220124/51217276/attachment.htm>


More information about the nginx mailing list