We have an nginx and several servers behind it.
Nginx runs LUA code to figure the right app server to route to. However, it uses Redis in doing so, and Redis can be out of date, but that would cause a request to be misrouted.
Now, the servers do have a way of validating reliably if they should process the request. What I'd like to achieve is the following response to misrouting:
1. The chosen server responds something that would indicate that the request was misrouted either via error code or a header.
2. Nginx sees that and instead of returning the error code to the client, it re-plays the routing logic which finds the updated value in Redis and routes the request correctly.
I wasn't able to find anything myself, please help.