Last active
May 6, 2019 05:59
-
-
Save anop72/c9b90caf0b6e32f2027a 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