Welcome! Log In Create A New Profile


Configuration for static contents 503 failover server

Posted by predominant 
Configuration for static contents 503 failover server
August 04, 2020 03:51AM
Hi Nginx users

I've created a cluster of servers that operates essentially as an overflow mechanism on load balancers. This cluster is added to physical load balancers with a lower priority, and in the event there is massive failure on the application servers, or exhaustion of connection limits, traffic will be directed to this cluster to say "Sorry, we're currently experiencing a problem, please check back later" (with a nice page, graphics, and CSS).

The reason for doing this with Nginx is for performance, and to permit application owners to customize the content of the page apologising for the service interruption. A CMS has been created behind the scenes that populates Nginx configuration based on a template, and places content into the required directories. This system currently serves about 1000 hostnames, and is expanding to at least 8 times that size in the next 6 months.

The current configuration isn't great. It's causing me problems as recently it was pointed out that POST/PUT requests are returning 405 errors instead of the custom content we've created.

Here is the configuration for an example host:

server {
listen 7003;
server_name graham-default-en.compmany.com;
root /htdocs/default-en/busy;

error_page 502 503 504 =503 @content;
error_page 405 /index.html;

location / {
try_files __force_503__.html =503;
location @content {
try_files $uri /index.html =404;
location /favicon.ico {
root /htdocs;
access_log off;

Here's some examples of requests and desired responses:

* GET / => 503 with content from root/index.html
* POST / => 503 with content from root/index.html
* PUT / => 503 with content from root/index.html
* GET /favicon.ico => 200 with content from root/favicon.ico

My trouble at the moment is getting this to accept a POST or PUT method, and either ignore it, or change it, to be able to send back a 503 with content. The GET requests are working OK.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 57
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready