Caching the result of the auth_request module
We are using nginx as a reverse proxy with http_auth_request_module . We would like to cache requests to our authentication server to reduce the load on that server. So far, this is the nginx configuration:
server {
...
location /sso {
auth_request /identity;
proxy_pass http://localhost:8081;
}
location /identity {
internal;
proxy_pass http://localhost:8081;
proxy_cache_path /opt/nginx/cache levels=1:2 keys=authentication:1m;
proxy_cache authentication;
proxy_cache_key $cookie_authentication;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
}
The request is accepted and authenticated. But nothing gets written to the cache directory. Nginx has sufficient permissions to write to the cache directory:
drwxrwxrwx 2 nobody wheel 68B Jul 18 16:34 cache
How can I make http_auth_request_module read from the cache and force nginx to write the response to the cache?
+3
source to share
No one has answered this question yet
Check out similar questions: