I'm sure this is a simple one but I'd like to get some insight on this. I have a vm running plex media server and I'm trying to setup mod_rewrite for this. I'd like to have an HTTP connection -> SSL -> Plex
Keeping it simple, without SSL the following works
ServerName plex
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
RewriteCond %{HTTPS} !=on
ProxyPass / http://127.0.0.1:32400/
ProxyPassReverse / http://127.0.0.1:32400/
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/web
RewriteCond %{HTTP:X-Plex-Device} ^$
RewriteRule ^/$ /web/$1 [R,L]
This allows me to enter
Which rewrites to
And removes my port number, now if I take the same as above and use https at lines 9 and 10 I break the rewrite.
Interestingly, if I use
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
RewriteCond %{HTTPS} !=on
ProxyPass / http://127.0.0.1:32400/
ProxyPassReverse / http://127.0.0.1:32400/
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/web
RewriteCond %{HTTP:X-Plex-Device} ^$
RewriteRule ^/?(.*) https://%{SERVER_NAME}:32400/web/$1 [R,L]
This works fine, but the port number is not removed. I understand this is because I'm including it in my rewrite rule.
So my question here is really two fold.
A) Why would using https instead of http at lines 9 and 10 not work as desired? B) What is the correct setup to forward http->https while using a rewrite rule?
tyia