Currently if Plex server is exposed on the internet and someone tries to access it, Plex forces you to login using plex id.
This nginx config tricks plex into thinking that request is coming from LAN.
# Control access to plex based on IPs | |
# This allows login to plex to remote hosts without login | |
# | |
# Change 192.168.0.50 to your Plex IP in proxy_pass | |
# | |
# Accessing plex remotely: http://remoteip:32400/web/index.html | |
# and you wont get login screen | |
# | |
# List of IPs access to Plex without auth | |
geo $geo { | |
default 0; | |
127.0.0.1/32 1; | |
8.8.8.8/32 1; | |
} | |
server { | |
listen 8080 default_server; | |
location / { | |
proxy_set_header Host 192.168.0.50; | |
proxy_set_header Referer 192.168.0.50; | |
proxy_set_header Origin 192.168.0.50; | |
proxy_set_header X-Real-IP 192.168.0.50; | |
proxy_set_header X-Forwarded-For 192.168.0.50; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
#Websockets | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_bind 192.168.0.50; | |
proxy_buffering off; | |
if ($geo = 1) { | |
proxy_pass http://192.168.0.50:32400; | |
} | |
} | |
} |
nice :)