Trigger alternate response based on file presence or other URL response

dhallam nginx-forum at
Thu Oct 18 16:50:29 UTC 2018


I'll try to make this make sense. I have a few web applications that I can't
change. They are behind an nginx+ loadbalancer. I have separate database
state that indicates whether or not requests should be forwarded to the
upstream, or a status page should be returned.

There is a web service that I can invoke that gives me access to the
database state. I tried using that service as a health_check uri to change
the upstream to "failed", but that doesn't work as the uri is just a path
appended to the host+port.

I could have something monitoring the database state web service running on
the nginx server instance that could, for example, create a flag file on the
nginx server instance that could indicate to nginx how it should deal with
the requests, but I'm not sure if/how I could configure that in nginx.

Would anyone have any suggestions on how I can control how nginx responds
based on state that isn't the upstream?

Many thanks for your help.

Posted at Nginx Forum:,281639,281639#msg-281639

More information about the nginx mailing list