taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

microcache_proxy.conf (2211B)


      1 # -*- mode: nginx; mode: flyspell-prog;  ispell-local-dictionary: "american" -*-
      2 
      3 ### Implementation of the microcache concept as presented here:
      4 ### http://fennb.com/microcaching-speed-your-app-up-250x-with-no-n
      5 
      6 ## The cache zone referenced.
      7 proxy_cache microcache;
      8 ## The cache key.
      9 proxy_cache_key $host$request_uri;
     10 
     11 ## For 200 and 301 make the cache valid for 15 seconds.
     12 proxy_cache_valid 200 301 15s;
     13 ## For 302 make it valid for 1 minute.
     14 proxy_cache_valid 302 1m;
     15 ## For 404 make it valid 1 second.
     16 proxy_cache_valid 404 1s;
     17 ## If there are any upstream errors or the item has expired use
     18 ## whatever it is available.
     19 proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
     20 ## The Cache-Control and Expires headers should be delivered untouched
     21 ## from the upstream to the client.
     22 proxy_ignore_headers Cache-Control Expires;
     23 ## Bypass the cache.
     24 proxy_cache_bypass $no_cache;
     25 proxy_no_cache $no_cache;
     26 ## Add a cache miss/hit status header.
     27 add_header X-Micro-Cache $upstream_cache_status;
     28 ## To avoid any interaction with the cache control headers we expire
     29 ## everything on this location immediately.
     30 expires epoch;
     31 
     32 ## Enable clickjacking protection in modern browsers. Available in
     33 ## IE8 also. See
     34 ## https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
     35 ## This may conflicts with pseudo streaming (at least with Nginx version 1.0.12).
     36 ## Uncomment the line below if you're not using media streaming.
     37 ## For sites *not* using frames uncomment the line below.
     38 #add_header X-Frame-Options DENY;
     39 ## For sites *using* frames uncomment the line below.
     40 #add_header X-Frame-Options SAMEORIGIN;
     41 
     42 ## Block MIME type sniffing on IE.
     43 add_header X-Content-Options nosniff;
     44 
     45 ## If you're using a Nginx version greater than 1.1.11 then uncomment
     46 ## the line below. See:
     47 ## http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_lock.
     48 ## Cache locking mechanism for protecting the backendof too many
     49 ## simultaneous requests.
     50 #proxy_cache_lock on;
     51 ## The default timeout, i.e., the time to way before forwarding the
     52 ## second request upstream if no reply as arrived in the meantime is 5s.
     53 # proxy_cache_lock_timeout 8000; # in miliseconds.