I tried to setup plex (with docker) behind a reverse proxy, so Plex is only accessible from https://plex.website.com/ and with my custom certificate. I had some troubles along the way, but in the end, I made it work!
Just wanted to share for you all. :-)
A big shout-out to rcombs for letting me know Plex.tv does an OPTIONS on your web server.
Link: https://gist.github.com/HazCod/3ef10a15f52c171a7839
(The link will typically have the latest version.)
`
ServerSignature Off
ServerTokens Prod
ServerName plex.website.com
# This VirtualHost redirects everything to HTTPS on port 443.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ServerName plex.website.com
ServerAlias ""
Options -Includes -ExecCGI
RewriteEngine On
RewriteCond %{THE_REQUEST} !HTTP/1.1$
RewriteRule .* - [F]
LimitRequestBody 512000
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/cert.pem
SSLCertificateKeyFile /etc/apache2/ssl/privkey.pem
SSLProtocol +TLSv1.2
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
Header always set X-Frame-Options DENY
FileETag None
TraceEnable off
Header edit Set-Cookie ^(.*)$ ;HttpOnly;Secure
Header set X-XSS-Protection "1; mode=block"
Timeout 60
<Location /:/websockets/notifications>
ProxyPass wss://plex:32400/:/websockets/notifications #plex here is resolved to my plex container
ProxyPassReverse wss://plex:32400/:/websockets/notifications #plex here is resolved to my plex container
</Location>
Order deny,allow
Allow from all
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://plex:32400/ #plex here is resolved to my plex container
ProxyPassReverse / http://plex:32400/ #plex here is resolved to my plex container
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/web
RewriteCond %{HTTP:X-Plex-Device} ^$
RewriteCond %{REQUEST_METHOD} !^(OPTIONS)$
RewriteRule ^/$ /web/$1 [R,L]
`