-
-
Save wateryoma/918349a192e30941fb2630b18d87b5d6 to your computer and use it in GitHub Desktop.
nginx use cookie as cache key
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
# guide https://www.nginx.com/blog/nginx-caching-guide/ | |
# document for variable http://nginx.org/en/docs/http/ngx_http_core_module.html#Variables | |
server { | |
... | |
location / { | |
# point is cookie name shouldn't contain - (hyphen), it cause wrong hash key. | |
# example $cookie_gist_var | |
proxy_cache_key $proxy_host$request_uri$cookie_{cookieNameShouldNotContainHyphen}; | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment