Skip to content

NVR with realtime local object detection for IP cameras

Only cache json requests with nginx (#8529)

Nicolas Mowen0b828ef1ec57
diff --git a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf
index 25131a1083..9251684633 100644
--- a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf
+++ b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf
@@ -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/ {