mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-24 15:35:46 +03:00
reuse pooled upstream connections for nginx auth subrequests
The /auth subrequest proxied to a variable address, which nginx can't pool, and its location-level headers dropped the inherited Connection header so nginx sent Connection: close. Every authenticated request opened and closed its own loopback connection to the API. It now proxies to the frigate_api upstream with an empty Connection header so the keepalive pool is reused.
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
set $upstream_auth http://127.0.0.1:5001/auth;
|
|
||||||
|
|
||||||
## Virtual endpoint created by nginx to forward auth requests.
|
## Virtual endpoint created by nginx to forward auth requests.
|
||||||
location /auth {
|
location /auth {
|
||||||
## Essential Proxy Configuration
|
## Essential Proxy Configuration
|
||||||
internal;
|
internal;
|
||||||
proxy_pass $upstream_auth;
|
proxy_pass http://frigate_api/auth;
|
||||||
|
|
||||||
## Headers
|
## Headers
|
||||||
|
|
||||||
@@ -39,6 +37,7 @@ location /auth {
|
|||||||
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; # Timeout if the real server is dead
|
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; # Timeout if the real server is dead
|
||||||
proxy_redirect http:// $scheme://;
|
proxy_redirect http:// $scheme://;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
proxy_cache_bypass $cookie_session;
|
proxy_cache_bypass $cookie_session;
|
||||||
proxy_no_cache $cookie_session;
|
proxy_no_cache $cookie_session;
|
||||||
proxy_buffers 4 32k;
|
proxy_buffers 4 32k;
|
||||||
|
|||||||
Reference in New Issue
Block a user