Advertisement
businessdad

Nginx - Dynamic cache key for Aelia products

Sep 22nd, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.38 KB | None | 0 0
  1. # Add Aelia cookies to the cache key. This will create multiple copies of each
  2. # cached page (one for each combination of currency, country and province/state)
  3. proxy_cache_key "$scheme$request_method$host$request_uri $cookie_aelia_cs_selected_currency$cookie_aelia_customer_country$cookie_aelia_customer_state$cookie_aelia_billing_country";
  4.  
  5. # IMPORTANT
  6. # This is an example configuration file, and the settings apply to the entire server.
  7. # You should probably adapt these settings to apply to a specific location, instead,
  8. # so that they only affect your specific ecommerce site.
  9. #
  10. # If you enter an incorrect configuration in Nginx, your web server could crash.
  11. # If you are not familiar with Nginx configuration, we recommend to contact your
  12. # developer, or hosting provider, who should be able to adjust the settings for you.
  13. server {
  14.   listen 80;
  15.   server_name www.example.org;
  16.  
  17.   set $no_cache 0;
  18.   # If none of the Aelia cookies are set, disable caching. This will ensure that
  19.   # the page is loaded dynamically, and that cookies are set at the next load
  20.   if ($cookie_aelia_cs_selected_currency$cookie_aelia_customer_country$cookie_aelia_customer_state$cookie_aelia_billing_country ~* "") {
  21.     set $no_cache 1;
  22.   }
  23.    
  24.   # Don't pull from cache based on $no_cache
  25.   fastcgi_cache_bypass $no_cache;
  26.   # Don't save to cache based on $no_cache
  27.   fastcgi_no_cache $no_cache;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement