I want to cache the token from my request header field Authorization.
Authorization : Bearer abcdefghijklmnopqrstuvwxyz
My goal is, that I don't have to validate every request on the validation-server. If the Authorization-Token is cached (and valid), than the request should call the API without validation.
location /main {
auth_request /auth;
proxy_ignore_headers Cache-Control;
proxy_pass http://API;
proxy_http_version 1.1;
}
location /auth {
internal;
proxy_cache my_cache;
proxy_ignore_headers Cache-Control;
proxy_cache_key "$http_authorization";
proxy_pass https://validationserver;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
}
This is my setup, but this does not work.
I hope you can help me.
Greetings!