Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only cache json requests with nginx #8529

Merged
merged 2 commits into from Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions docker/main/rootfs/usr/local/nginx/conf/nginx.conf
Expand Up @@ -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;
Expand Down Expand Up @@ -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/ {
Expand Down