fix(jellyfin): Proxy websockets

- This fixes Jellyfin's SyncPlay feature.
- This config is actually pasted from their setup guide.  Not sure how I
  missed it.
This commit is contained in:
Madeleine Sydney
2025-02-23 19:07:21 -07:00
parent c738bed3d8
commit c8ba339b4b
2 changed files with 41 additions and 11 deletions

View File

@@ -136,12 +136,12 @@ in {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
extraConfig = '' extraConfig = ''
set $upstream http://127.0.0.1:${builtins.toString cfg.httpPort}; set $upstream http://127.0.0.1:${builtins.toString cfg.httpPort};
''; '';
locations."/".extraConfig = '' locations."/".extraConfig = ''
include ${./authelia/proxy.conf}; include ${./authelia/proxy.conf};
proxy_pass $upstream; proxy_pass $upstream;
''; '';
locations."/api/verify".proxyPass = "$upstream"; locations."/api/verify".proxyPass = "$upstream";
locations."/api/authz".proxyPass = "$upstream"; locations."/api/authz".proxyPass = "$upstream";
}; };

View File

@@ -28,12 +28,42 @@ in {
openFirewall = true; openFirewall = true;
}; };
sydnix.deertopia.nginx.vhosts."watch".vhost = { sydnix.deertopia.nginx.vhosts."watch".vhost =
forceSSL = true; # Currently no (convenient) way to specify Jellyfin's port from Nix.
enableACME = true; let port = builtins.toString 8096;
locations."/" = { in {
proxyPass = "http://localhost:8096"; # Uses default port. forceSSL = true;
enableACME = true;
locations."/".extraConfig = ''
# Proxy main Jellyfin traffic.
proxy_pass $jellyfin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
# Disable buffering when the nginx proxy gets very resource heavy upon
# streaming.
proxy_buffering off;
'';
locations."/socket".extraConfig = ''
# Proxy Jellyfin Websockets traffic
proxy_pass $jellyfin;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
'';
extraConfig = ''
set $jellyfin http://127.0.0.1:${port};
'';
}; };
};
}; };
} }