Skip to content

Instantly share code, notes, and snippets.

@jinto
Last active July 8, 2023 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinto/f120e497db8d39d866db49ff2454b7b3 to your computer and use it in GitHub Desktop.
Save jinto/f120e497db8d39d866db49ff2454b7b3 to your computer and use it in GitHub Desktop.
Working config for auth_request with proxy_cache. (nginx 1.18.0)
# Working config for auth_request with proxy_cache. (nginx 1.18.0)
# https://gist.github.com/jinto/f120e497db8d39d866db49ff2454b7b3
# ...
proxy_cache_path /tmp/cache_xx levels=1:2 keys_zone=auth_cache:10m max_size=128m inactive=10m use_temp_path=off;
server {
location / {
auth_request /_ml_proxy/auth;
# ...
proxy_pass http://backend_ip:7860/;
}
location ~ ^/_ml_proxy/auth { internal;
include proxy_params;
proxy_cache auth_cache;
proxy_cache_methods GET HEAD POST;
proxy_cache_key $cookie_sessionid; # for django
proxy_cache_valid 200 1m;
proxy_pass http://backend_auth_ip;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment