Welcome! Log In Create A New Profile

Advanced

change the HTTP status code returned when proxy_pass gateway is down

Posted by j0hn 
change the HTTP status code returned when proxy_pass gateway is down
March 25, 2016 01:25AM
Hi
we would like to change the HTTP status code to 200 whenever the backend ("http://example.com/auth") machine behind nginx goes down for some reason.
Is this possible via nginx?

location /files {
auth_request /auth;
set $auth_key $arg_key;
}

location /auth {
internal;
proxy_pass http://example.com/auth;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Key $auth_key;
}



Edited 1 time(s). Last edit at 03/25/2016 01:25AM by j0hn.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 101
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