diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-03-01 23:32:25 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-03-01 23:32:25 +0100 |
commit | 8a1178cb9785495784ef200757e5b8a61772290a (patch) | |
tree | 763e5079bfa9f8948bd1fd217731329b24d2d0d3 /etc/nginx/apps/drupal/map_cache.conf | |
parent | b03a3623188e2f7e32ca226877f6f4a28d4471db (diff) | |
download | deployment-8a1178cb9785495784ef200757e5b8a61772290a.tar.gz deployment-8a1178cb9785495784ef200757e5b8a61772290a.tar.bz2 deployment-8a1178cb9785495784ef200757e5b8a61772290a.zip |
missing drupal stuff
Diffstat (limited to 'etc/nginx/apps/drupal/map_cache.conf')
-rw-r--r-- | etc/nginx/apps/drupal/map_cache.conf | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/etc/nginx/apps/drupal/map_cache.conf b/etc/nginx/apps/drupal/map_cache.conf new file mode 100644 index 0000000..8166fcd --- /dev/null +++ b/etc/nginx/apps/drupal/map_cache.conf @@ -0,0 +1,39 @@ +# -*- mode: nginx; mode: flyspell-prog; ispell-current-dictionary: american -*- + +### Testing if we should be serving content from cache or not. This is +### needed for any Drupal setup that uses an external cache. + +## Let Ajax calls go through. +map $uri $no_cache_ajax { + default 0; + /system/ajax 1; +} + +## Testing for the session cookie being present. If there is then no +## caching is to be done. Note that this is for someone using either +## Drupal 7 pressflow or stock Drupal 6 core with no_anon +## (http://drupal.org/project/no_anon). +map $http_cookie $no_cache_cookie { + default 0; + ~SESS 1; # PHP session cookie +} + +## Combine both results to get the cache bypassing mapping. +map $no_cache_ajax$no_cache_cookie $no_cache { + default 1; + 00 0; +} + +## If you're using stock Drupal 6 without no_anon, i.e., there's a +## session cookie being served even to anonymous users, then uncomment +## the three lines below and comment the above map directive +# map $http_cookie $no_cache { +# default 0; +# ~DRUPAL_UID 1; # DRUPAL_UID cookie set by Boost +# } + +## Set a cache_uid variable for authenticated users. +map $http_cookie $cache_uid { + default nil; # hommage to Lisp :) + ~SESS[[:alnum:]]+=(?<session_id>[[:graph:]]+) $session_id; +} |