In our application whenever a token (that arrives in a header) is invalid - it is practically guaranteed there won't be an exact valid token. So I'm trying to offload the responsibility of responsding 401 to nginx (with or without njs) Trying to avoid maintaining a service with a cache that is being hammered by invalid requests.
I was thinking to js_content each call and check in a local "in memory cache" of the invalid token or even better to have an API to nginx cache but I can't seem to find documentation on any of the above.
Auth request doesn't seem helpful since I won't have a way populating the cache with a 401 that will be returned from my service (in a "cache miss")
Any other possible way will be welcomed but I would like to acheive the ability to offload this to nginx