Skip to content

Instantly share code, notes, and snippets.

@guptarohit
Created July 26, 2019 05:59
Show Gist options
  • Select an option

  • Save guptarohit/f2bc5203968c4d9250151c734c5be7ba to your computer and use it in GitHub Desktop.

Select an option

Save guptarohit/f2bc5203968c4d9250151c734c5be7ba to your computer and use it in GitHub Desktop.

Revisions

  1. guptarohit created this gist Jul 26, 2019.
    12 changes: 12 additions & 0 deletions nginx_app_cache.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    proxy_cache_path /data/nginx/cache keys_zone=my_zone:10m inactive=1d;
    server {
    ...
    location /api-endpoint/ {
    proxy_cache my_zone;
    proxy_cache_key "$host$request_uri$http_authorization";
    proxy_cache_valid 404, 302 1m;
    proxy_cache_valid 200 1d;
    add_header X-Cache-Status $upstream_cache_status;
    }
    ...
    }