mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Only cache json requests with nginx (#8529)
* Only cache json requests * Use map instead
This commit is contained in:
parent
3359123364
commit
0b828ef1ec
@ -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;
|
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 {
|
upstream frigate_api {
|
||||||
server 127.0.0.1:5001;
|
server 127.0.0.1:5001;
|
||||||
keepalive 1024;
|
keepalive 1024;
|
||||||
@ -192,6 +197,7 @@ http {
|
|||||||
proxy_cache_use_stale updating;
|
proxy_cache_use_stale updating;
|
||||||
proxy_cache_valid 200 5s;
|
proxy_cache_valid 200 5s;
|
||||||
proxy_cache_bypass $http_x_cache_bypass;
|
proxy_cache_bypass $http_x_cache_bypass;
|
||||||
|
proxy_no_cache $should_not_cache;
|
||||||
add_header X-Cache-Status $upstream_cache_status;
|
add_header X-Cache-Status $upstream_cache_status;
|
||||||
|
|
||||||
location /api/vod/ {
|
location /api/vod/ {
|
||||||
|
Loading…
Reference in New Issue
Block a user