Welcome! Log In Create A New Profile

Advanced

modify response code based on upstream response

Jeremy Piven
September 28, 2014 04:52PM
I have a set of webservers with nginx acting as a reverse proxy for
tomcat behind an AWS ELB.

Request -> AWS ELB -> Nginx -> Tomcat

To understand if my application is healthy or not I have to send a
request for /status/health. If "health:0" comes back it means the server
is not ready to serve traffic. If "health:1" comes back it means the
server is ready to serve traffic. Unfortunately, in both scenarios the
http response code is always 200. Since AWS ELB has a dumb healthcheck
method I can't place a server in or out of rotation based on the actual
response output. AWS only considers http response code.

Is it possible to have Nginx modify the http response code based on the
upstream output? I want to basically say if the tomcat response is
"health:0" return an http response code 503.

--
Jeremy Piven
jeremypiven@fastmail.fm

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

modify response code based on upstream response

Jeremy Piven September 28, 2014 04:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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