mirror of
https://github.com/thegeneralist01/config.git
synced 2026-12-04 18:56:56 +01:00
thegeneralist(plex): allow LAN subnet 32400 and mask Tailscale proxy IP
This commit is contained in:
parent
0228521e96
commit
2d7bab16d4
1 changed files with 15 additions and 3 deletions
|
|
@ -26,7 +26,9 @@ let
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://127.0.0.1:32400";
|
proxyPass = "http://127.0.0.1:32400";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
recommendedProxySettings = true;
|
# Disable per-location recommended headers so they don't overwrite
|
||||||
|
# the localhost X-Real-IP / X-Forwarded-For override below.
|
||||||
|
recommendedProxySettings = false;
|
||||||
# https://arne.me/blog/plex-on-nixos
|
# https://arne.me/blog/plex-on-nixos
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
# Some players don't reopen a socket and playback stops totally instead of resuming after an extended pause
|
# Some players don't reopen a socket and playback stops totally instead of resuming after an extended pause
|
||||||
|
|
@ -47,9 +49,13 @@ let
|
||||||
# Buffering off send to the client as soon as the data is received from Plex.
|
# Buffering off send to the client as soon as the data is received from Plex.
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
# This vhost only listens on Tailscale (100.108.125.63); present Tailscale
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
# clients as local loopback so Plex doesn't treat 100.64.0.0/10 as remote.
|
||||||
|
proxy_set_header X-Real-IP 127.0.0.1;
|
||||||
|
proxy_set_header X-Forwarded-For 127.0.0.1;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Server $hostname;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
@ -86,6 +92,12 @@ in
|
||||||
allowedUDPPorts = [ 1900 5353 32410 32412 32413 32414 ];
|
allowedUDPPorts = [ 1900 5353 32410 32412 32413 32414 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Allow Plex direct access from the home LAN subnet without exposing 32400 globally.
|
||||||
|
# tailscale0 is already trusted in modules/linux/tailscale.nix.
|
||||||
|
networking.firewall.extraCommands = ''
|
||||||
|
iptables -A nixos-fw -s 192.168.2.0/24 -p tcp --dport 32400 -j nixos-fw-accept
|
||||||
|
'';
|
||||||
|
|
||||||
services.nginx.virtualHosts = {
|
services.nginx.virtualHosts = {
|
||||||
${domain} = config;
|
${domain} = config;
|
||||||
"100.108.125.63" = config;
|
"100.108.125.63" = config;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue