FAQ  •  Register  •  Login

ReverseProxy force https

<<

virtua

Serviio newbie

Posts: 7

Joined: Thu Sep 14, 2017 12:38 pm

Post Thu Sep 14, 2017 2:06 pm

ReverseProxy force https

Hi,
I would like to join my windows serviio Browser from my office, hotel ... (only 443 is authorized==> https://serviio.mydomain.org)
I have implemented an apache reverse proxy on a debian.

Please see the main code :

  Code:
<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerName serviio.mydomain.ord
                ServerAdmin webmaster@192.168.x.x
                ProxyPreserveHost Off
                ProxyRequests Off
                ProxyPass / "http://192.168.x.x:23424/mediabrowser/"
                ProxyPassReverse / "http://192.168.x.x:23424/mediabrowser/"
                ProxyPass / "http://192.168.x.x:23424/cds/"
                ProxyPassReverse / "http://192.168.x.x:23424/cds/"


I can join the login page but my credential are not recognized ==> "Unknown Server Error (401, undefined error)"

I guess the problem doesn't provide from serviio but from my config
I have seen the previous post http://forum.serviio.org/viewtopic.php?f=5&t=21227 and try the code but it'a a mess. I obtain an another site hosted on my debian. ^^'

Serviio is hosted on a W2K2012 R2 and Apache(2.4) Reverse Proxy on a Debian 8

Can someone help me please to fix this issue please


Thanks a lot
Virtua
<<

bolzass

Serviio lover

Posts: 67

Joined: Thu Jan 02, 2014 6:32 pm

Post Thu Sep 14, 2017 11:03 pm

Re: ReverseProxy force https

Hi!
Set debug log (http://wiki.serviio.org/doku.php?id=detail_logging) as you will see all the messages.

Any way, try setting
  Code:
ProxyPreserveHost On
and change URL! (cannot be the same for app and cds!):
  Code:
<IfModule mod_proxy.c>
  <IfModule mod_proxy_http.c>
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass /mediabrowser/ "http://192.168.x.x:23424/mediabrowser/"
    ProxyPassReverse /mediabrowser/ "http://192.168.x.x:23424/mediabrowser/"
    ProxyPass /cds/ "http://192.168.x.x:23424/cds/"
    ProxyPassReverse /cds/ "http://192.168.x.x:23424/cds/"
  </IfModule>
</IfModule>


Chek config with: "apache2ctl configtest"

You will access as:
  Code:
https://serviio.mydomain.org/mediabrowser/
(last "/" is important).

You can play also, moreover, rewrite rules:
  Code:
<Directory /www/>
  ...
  RewriteEngine On
  RewriteRule ^(.*) http://192.168.x.x:23424/mediabrowser/$1 [R]
  ...
</Directory>

You will access as:
  Code:
https://serviio.mydomain.org/
or https://serviio.mydomain.org/foo
or https://serviio.mydomain.org/*****
(it will redirect everything to /mediabrowser/).



Regards.
<<

virtua

Serviio newbie

Posts: 7

Joined: Thu Sep 14, 2017 12:38 pm

Post Mon Sep 18, 2017 3:39 pm

Re: ReverseProxy force https

Hello Bolzass,
thank you very much for your help.
For the moment I do my test without https but http (80).

I'm afraid my level is too weak to understand your advices.
I don't know what is exactly rewriting, header...
I believe understand that my client touch the Servioo server through apache reverse proxy but serviio cannot find the client back because it doesn't know what is the client address (socket).
I follow my research on the web without success for the moment.
Maybe do you know an easy tutorial about that.

http://httpd.apache.org/docs/2.4/ and others pages https://httpd.apache.org/docs/2.4/en/mod/mod_remoteip.html are to complicated for the moment ;(

I hope I will do it cause I would like to do the same with other system.
I'd like the possibility to join all my servers by only 443 and 80
Could you tell me if I seek in the right direction

Many thanks
Virtua
<<

bolzass

Serviio lover

Posts: 67

Joined: Thu Jan 02, 2014 6:32 pm

Post Mon Sep 18, 2017 6:08 pm

Re: ReverseProxy force https

Hi Virtua!

Ok, no worries. In this case I suggest going step by step.

First, forget what I said about rewriting rules (is for "answer" depending on what http client ask for..., better let's left for the end as is not necessary) .

OK, looking the code you posted, replace it with:
  Code:
<IfModule mod_proxy.c>
  <IfModule mod_proxy_http.c>
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass /mediabrowser/ "http://192.168.x.x:23424/mediabrowser/"
    ProxyPassReverse /mediabrowser/ "http://192.168.x.x:23424/mediabrowser/"
    ProxyPass /cds/ "http://192.168.x.x:23424/cds/"
    ProxyPassReverse /cds/ "http://192.168.x.x:23424/cds/"
  </IfModule>
</IfModule>

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerName serviio.mydomain.ord
                ServerAdmin webmaster@192.168.x.x
...???? /* You cut it, so I don't know if there is sth more ...*/

</IfModule>


Then, from the command line run: "apache2ctl configtest" without the quotes to test syntax of what you written down.

Finally, restart apache ("/etc/init.d/apache restart") and test it. You will access as:
  Code:
http://serviio.mydomain.org/mediabrowser/
(last "/" is important).

Now it should be working only on :80

If this works, we can continue with https and rewrite rules if you want.

Regards.
<<

virtua

Serviio newbie

Posts: 7

Joined: Thu Sep 14, 2017 12:38 pm

Post Mon Sep 25, 2017 9:27 am

Re: ReverseProxy force https

Hello Bolzass,
Thank you again for your help.
I had not much time last week.
I try with this code :

  Code:
                ServerName serviio.domain.org
                ServerAdmin webmaster@192.168.x.x
<IfModule mod_proxy.c>
  <IfModule mod_proxy_http.c>
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass /mediabrowser/ "http://192.168.x.x:23424/mediabrowser/"
    ProxyPassReverse /mediabrowser/ "http://192.168.x.x:23424/mediabrowser/"
    ProxyPass /cds/ "http://192.168.x.x:23424/cds/"
    ProxyPassReverse /cds/ "http://192.168.x.x:23424/cds/"
  </IfModule>
</IfModule>


http://serviio.domain.org give an another site from my sites collection
but http://serviio.domain.org/mediabrower/ IS WORKING !!!!!!!!!!!! :D :D
When I use
  Code:
    ProxyPass /cds/ "http://192.168.x.x:23424/cds/"
    ProxyPassReverse /cds/ "http://192.168.x.x:23424/cds/"

with the same internal IP Address used for mediabrowser, password is accepted and webbrowser go further

I understand :
  Code:
<IfModule mod_proxy.c>
  <IfModule mod_proxy_http.c>

makes the difference !

At this moment, I'm not in a fast environnement. I feel performance of my video player are bad.
Give the reverse proxy low performance ?


Thank you very very much !!!!
Regards,
Virtua
<<

virtua

Serviio newbie

Posts: 7

Joined: Thu Sep 14, 2017 12:38 pm

Post Mon Sep 25, 2017 10:34 am

Re: ReverseProxy force https

Hey,
I implemented wtih 443 and it's very well !!!
Performance are not reduced by ssl
I can't show 1080p video with no pb !!
It's working perfectly !!!
I'm very happy to been helped so good !!
:D :D :D

Thank you very much again !!!

Virtua :lol:
<<

bolzass

Serviio lover

Posts: 67

Joined: Thu Jan 02, 2014 6:32 pm

Post Thu Oct 05, 2017 7:54 am

Re: ReverseProxy force https

Hi Virtua!
Have been away :P ...

About performance... shouldn't have much impact :roll: . Sth more is happening there :?: , but happy you have it working with SSL (much better!!!).

About:
http://serviio.domain.org give an another site from my sites collection
but http://serviio.domain.org/mediabrower/ IS WORKING !!!!!!!!!!!! :D :D

Here is were you can play with rewrite rules. Easy, just include the following:
  Code:
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteRule ^(.*) /mediabrowser/ [NE,QSA,L,R=301]
</IfModule>

So, when you ask for http://serviio.domain.org or http://serviio.domain.org/whateveryouwrite, will be re-writed ("same effect as redirected") to your proxied mediabrowser.


Note: What made the difference was the paths in your original snippet (you didn't specified /mediabrowser/ neither /cds/).


Anyway, congrats!

BR!

Return to Serviio Support & Help

Who is online

Users browsing this forum: No registered users and 36 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.