Last active
July 8, 2023 16:07
-
-
Save jinto/f120e497db8d39d866db49ff2454b7b3 to your computer and use it in GitHub Desktop.
Working config for auth_request with proxy_cache. (nginx 1.18.0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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