summaryrefslogtreecommitdiff
path: root/historic/guix/etc/nginx/apps/drupal/microcache_proxy_auth.conf
diff options
context:
space:
mode:
Diffstat (limited to 'historic/guix/etc/nginx/apps/drupal/microcache_proxy_auth.conf')
-rw-r--r--historic/guix/etc/nginx/apps/drupal/microcache_proxy_auth.conf54
1 files changed, 54 insertions, 0 deletions
diff --git a/historic/guix/etc/nginx/apps/drupal/microcache_proxy_auth.conf b/historic/guix/etc/nginx/apps/drupal/microcache_proxy_auth.conf
new file mode 100644
index 0000000..e351b1b
--- /dev/null
+++ b/historic/guix/etc/nginx/apps/drupal/microcache_proxy_auth.conf
@@ -0,0 +1,54 @@
+# -*- mode: nginx; mode: flyspell-prog; ispell-local-dictionary: "american" -*-
+
+### Implementation of the microcache concept as presented here:
+### http://fennb.com/microcaching-speed-your-app-up-250x-with-no-n
+
+## The cache zone referenced.
+proxy_cache microcache;
+## The cache key.
+proxy_cache_key $cache_uid@$host$request_uri;
+
+## For 200 and 301 make the cache valid for 15 seconds.
+proxy_cache_valid 200 301 15s;
+## For 302 make it valid for 1 minute.
+proxy_cache_valid 302 1m;
+## For 404 make it valid 1 second.
+proxy_cache_valid 404 1s;
+## If there are any upstream errors or the item has expired use
+## whatever it is available.
+proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
+## The Cache-Control and Expires headers should be delivered untouched
+## from the upstream to the client.
+proxy_ignore_headers Cache-Control Expires;
+proxy_pass_header Set-Cookie;
+proxy_pass_header Cookie;
+## Bypass the cache.
+proxy_cache_bypass $no_auth_cache;
+proxy_no_cache $no_auth_cache;
+## Add a cache miss/hit status header.
+add_header X-Micro-Cache $upstream_cache_status;
+## To avoid any interaction with the cache control headers we expire
+## everything on this location immediately.
+expires epoch;
+## Enable clickjacking protection in modern browsers. Available in
+## IE8 also. See
+## https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
+## This may conflicts with pseudo streaming (at least with Nginx version 1.0.12).
+## Uncomment the line below if you're not using media streaming.
+## For sites *not* using frames uncomment the line below.
+#add_header X-Frame-Options DENY;
+## For sites *using* frames uncomment the line below.
+#add_header X-Frame-Options SAMEORIGIN;
+
+## Block MIME type sniffing on IE.
+add_header X-Content-Options nosniff;
+
+## If you're using a Nginx version greater than 1.1.11 then uncomment
+## the line below. See:
+## http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_lock.
+## Cache locking mechanism for protecting the backendof too many
+## simultaneous requests.
+#proxy_cache_lock on;
+## The default timeout, i.e., the time to way before forwarding the
+## second request upstream if no reply as arrived in the meantime is 5s.
+# proxy_cache_lock_timeout 8000; # in miliseconds.