Trigger alternate response based on file presence or other URL response
Reinis Rozitis
r at roze.lv
Thu Oct 18 22:43:40 UTC 2018
> Wondering if there is a way to use the URL endpoint to check.
One way to do it would be with: http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
You said you have nginx+ which has the ability to reconfigure the the backends on the fly: http://nginx.org/en/docs/http/ngx_http_upstream_conf_module.html
So your application which can read the state from the database could just set the upstream(s) as down so nginx won't forward any requests.
Another (more advanced) way would be to do it inside nginx with lua ( https://github.com/openresty/lua-nginx-module ) wich can connect directly to the database (mysql/pgsql etc) and decide what response to return. Then again it's more complicated.
rr
More information about the nginx
mailing list