Last active
August 29, 2015 14:25
-
-
Save trepmal/5bdf31321d19aa515534 to your computer and use it in GitHub Desktop.
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
# this goes in the http{} block | |
# remove any $no_cache "sets" from individual site confs (e.g. ` set $no_cache 0;`) | |
# 0 means we cache | |
# any other value will negate it | |
#check cookie for certain logged-in-type values, if found set 1 | |
map $http_cookie $no_cookie_cache { | |
default 0; | |
"~comment_author_|wordpress_(?!test_cookie)|wp-postpass_" 1; | |
} | |
#check uri for certain logged-in-type values, if found set 1 | |
#originally used $request_uri, but this includes the query string which makes it easier to bypass accidentally or maliciously | |
map $uri $no_uri_cache { | |
default 0; | |
"~wp-admin|wp-login.php" 2; | |
} | |
#finally, check if both values are 0 ("00"), any other combo means something should bypass | |
map $no_cookie_cache$no_uri_cache $no_cache { | |
default 1; | |
"00" 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment