@@ -36,7 +36,7 @@ server {
3636 return 301 $scheme://$host/phpmyadmin/;
3737 }
3838
39- location ~ \ /phpmyadmin {
39+ location ~ ^ /phpmyadmin/ {
4040 rewrite ^/phpmyadmin(/.*)$ $1 break;
4141 proxy_set_header Host $host;
4242 proxy_set_header X-Forwarded-Scheme $scheme;
@@ -61,7 +61,7 @@ server {
6161 if ($request_method = PUT) { set $skip_cache 1; }
6262 if ($request_method = PATCH) { set $skip_cache 1; }
6363
64- # Four maps defined in nginx.conf (http context) resolve all cache
64+ # Five maps defined in nginx.conf (http context) resolve all cache
6565 # exclusion logic. We don't use:
6666 #
6767 # if ($query_string != "") { set $skip_cache 1; }
@@ -71,6 +71,7 @@ server {
7171 # $skip_cache_path — path-based exclusions (keyed on $uri)
7272 # $skip_cache_query — query-param exclusions (keyed on $query_string)
7373 # $skip_cache_cookie — cookie-based exclusions (keyed on $http_cookie)
74+ # $skip_cache_cart — wc-cart exclusions (keyed on $cookie_woocommerce_items_in_cart)
7475 # $skip_cache_xhr — ajax-based exclusions (keyed on $http_x_requested_with)
7576 #
7677 # This approach allows higher level Nginx cache ratios for WooCommerce.
@@ -123,9 +124,17 @@ server {
123124 fastcgi_cache_bypass $skip_cache;
124125 fastcgi_no_cache $skip_cache;
125126 fastcgi_cache NPP;
126- fastcgi_cache_valid 30d;
127- fastcgi_cache_use_stale error timeout updating invalid_header http_500 http_503;
127+ fastcgi_cache_valid 200 30d;
128+ fastcgi_cache_valid 404 1m;
129+ fastcgi_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
128130 fastcgi_cache_lock on;
131+ fastcgi_cache_background_update on;
132+
133+ # Prevent cookie leakage: remove Set-Cookie headers from cacheable responses
134+ # so that one user's cookies are never served to another user from cache.
135+ if ($skip_cache = 0) {
136+ more_clear_headers "Set-Cookie*";
137+ }
129138
130139 # Prevents Nginx from splitting cache into multiple variants per URL.
131140 # When PHP-FPM sends "Vary: Accept-Encoding", Nginx computes a secondary MD5 key
0 commit comments