Only cache json requests with nginx (#8529)

* Only cache json requests

* Use map instead
This commit is contained in:
Nicolas Mowen 2023-11-07 16:18:58 -07:00 committed by GitHub
parent 3359123364
commit 0b828ef1ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,11 @@ http {
proxy_cache_path /dev/shm/nginx_cache levels=1:2 keys_zone=api_cache:10m max_size=10m inactive=1m use_temp_path=off;
map $http_accept $should_not_cache {
'application/json' 0;
default 1;
}
upstream frigate_api {
server 127.0.0.1:5001;
keepalive 1024;
@ -192,6 +197,7 @@ http {
proxy_cache_use_stale updating;
proxy_cache_valid 200 5s;
proxy_cache_bypass $http_x_cache_bypass;
proxy_no_cache $should_not_cache;
add_header X-Cache-Status $upstream_cache_status;
location /api/vod/ {