Skip to content

Instantly share code, notes, and snippets.

@johnhpatton
Created February 4, 2021 02:27
Show Gist options
  • Save johnhpatton/90b2cf358a6201f02cd46ade8ccf0ced to your computer and use it in GitHub Desktop.
Save johnhpatton/90b2cf358a6201f02cd46ade8ccf0ced to your computer and use it in GitHub Desktop.
Proxy Cache Configuration
# Allow only one request at a time to populate a new cache element, duplicate requests will wait
# for 5s or the time set with proxy_cache_lock_timeout if set.
proxy_cache_lock on;
# Allow background cache update for request, serve stale during update.
# NOTES
# - requires enabling serve stale on update with proxy_cache_use_stale directive
# containing the "updating" parameter.
proxy_cache_background_update on;
# Conditions allowing stale responses.
proxy_cache_use_stale error
timeout
invalid_header
updating
http_500
http_502
http_503
http_504;
# Ignore Cache Control headers
# NOTES
# - Allow nginx to control cache.
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
# Product Availability Responses Cache Zone
proxy_cache_path /var/cache/nginx/availability levels=1:2 keys_zone=availability:1m max_size=10m inactive=5m use_temp_path=off;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment