Tag Info

Hot answers tagged

2

Can't you get by with using an error_page directive, and then handle the location separately with the added header? e.g. in Nginx: server { ... error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; add_header Cache-Control "no-cache" always; } }


2

You can do it this way too : map $status $cache_header { default <for_other_codes>; 404 "no-cache" } server { [ ... ] add_header "Cache-Control" $cache_header always; }


2

You need to increase the size of shared memory on keys_zone instead of max_size. Stealing answer from this thread keys_zone=api-data-cache:8m was defining shared memory zone named api-data-cache with maximum size 8 MB. It holds all active keys and metadata of the cache. So, whenever nginx checks if a page was cached, it consults the shared memory zone ...



Only top voted, non community-wiki answers of a minimum length are eligible