From 18545718c1c8c68b30353a176d6d71c13fe447c0 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 21 Oct 2023 09:15:24 -0400 Subject: [PATCH] refactor and disable access logs for stats and version (#8259) --- .../rootfs/usr/local/nginx/conf/nginx.conf | 51 +++++++++---------- .../rootfs/usr/local/nginx/conf/proxy.conf | 4 ++ 2 files changed, 27 insertions(+), 28 deletions(-) create mode 100644 docker/main/rootfs/usr/local/nginx/conf/proxy.conf diff --git a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf index a857461b5..edf28efea 100644 --- a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf @@ -149,62 +149,57 @@ http { location /ws { proxy_pass http://mqtt_ws/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header Host $host; + include proxy.conf; } location /live/jsmpeg/ { proxy_pass http://jsmpeg/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header Host $host; + include proxy.conf; } location /live/mse/ { proxy_pass http://go2rtc/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header Host $host; + include proxy.conf; } location /live/webrtc/ { proxy_pass http://go2rtc/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header Host $host; + include proxy.conf; } location ~* /api/go2rtc([/]?.*)$ { proxy_pass http://go2rtc; rewrite ^/api/go2rtc(.*)$ /api$1 break; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header Host $host; + include proxy.conf; } location ~* /api/.*\.(jpg|jpeg|png)$ { rewrite ^/api/(.*)$ $1 break; proxy_pass http://frigate_api; - proxy_pass_request_headers on; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + include proxy.conf; } location /api/ { add_header Cache-Control "no-store"; expires off; proxy_pass http://frigate_api/; - proxy_pass_request_headers on; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + include proxy.conf; + + location /api/stats { + access_log off; + add_header Cache-Control "no-store"; + expires off; + proxy_pass http://frigate_api/; + include proxy.conf; + } + + location /api/version { + access_log off; + add_header Cache-Control "no-store"; + expires off; + proxy_pass http://frigate_api/; + include proxy.conf; + } } location / { diff --git a/docker/main/rootfs/usr/local/nginx/conf/proxy.conf b/docker/main/rootfs/usr/local/nginx/conf/proxy.conf new file mode 100644 index 000000000..442c78718 --- /dev/null +++ b/docker/main/rootfs/usr/local/nginx/conf/proxy.conf @@ -0,0 +1,4 @@ +proxy_http_version 1.1; +proxy_set_header Upgrade $http_upgrade; +proxy_set_header Connection "Upgrade"; +proxy_set_header Host $host; \ No newline at end of file