SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Customizations
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-01-2008, 04:44 AM
jhh jhh is offline
Sage Advanced User
 
Join Date: Nov 2003
Location: BE
Posts: 196
Web user interface(s) related - reverse proxy

Hi,

I have too many webservers:

Nielms - excellent- webserver,
Nielms webserver on a second PC to do transcoding occasionally as the SageTV server does not have enough power to do placeshifting,
IP power switch webserver, to switch the previous one on
the mobile device webserver -jreichen is working on- which I plan to look into,
a webmail server,
a home automation webserver,

My challenge is that I'm running out of port numbers. This has -of course- nothing the do with the corporate environment I live in being somewhat restrictive on what ports they allow traffic on.

I think the solution is a reverse proxy but could use some pointers on which one is easy to use and allows some kind of portforwarding/remapping and URL juggling. I've done a search on the forum and there is not that much on reverse proxy - nobody is doing this or it is really easy? Any suggestions?

Jan
Reply With Quote
  #2  
Old 07-01-2008, 06:59 AM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
You could try the Apache proxy module bcjenkins documented on the SagePlugins wiki. I've never used it myself but would be interested in hearing how it works out if you set it up. I'm sure others would, too.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun.
Extender: STP-HD300, Harmony 550 Remote,
Netgear MCA1001 Ethernet over Coax.
SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client
, Java 1.6.
Plugins: Jetty, Nielm's Web Server, Mobile Web Interface.

Reply With Quote
  #3  
Old 07-01-2008, 08:17 AM
krikkit's Avatar
krikkit krikkit is offline
Sage User
 
Join Date: Nov 2005
Location: Austria (Europe)
Posts: 41
using apache as reverse proxy for sagetv webserver and various other webservers for more than 3 years now, works really fine and adds additional layer of security cause of ssl, only the streaming out of the sage webserver does not work over reverse proxy (a feature i do not use)
__________________
WWW: http://www.krikkit.net

Server: Athlon X2 4850e (2x2,5Ghz); AMD 780G Chipset, 2 Gb RAM ; ATI Radeon HD 3200; Technotrend S2-3200 DVB-S + CI, Hauppauge PVR 150 (only as IR receiver)
Winows XP Pro; SageTV v6.4.5
Clients: Placeshifter
Reply With Quote
  #4  
Old 07-01-2008, 09:12 AM
jhh jhh is offline
Sage Advanced User
 
Join Date: Nov 2003
Location: BE
Posts: 196
hm, that's still worth a try. Although I do use streaming from the webserver.

My normal SageTV server is optimized for energy efficiency - so it is not able to transcode at all. Therefore I have the IP power switch (with webserver ) to be able to switch on a second server when I'm abroad. That one has SageTV Client which runs a second Nielm webserver. That one then enables me to do transcoded streaming.

It would be nice if there was some sort of network encoder version of the placeshifter server component but that is another story.
Reply With Quote
  #5  
Old 07-01-2008, 07:15 PM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
You could also do something like an SSH tunnel over a single standard port with a few forwards of local ports. May not work so well for streaming media though.

B

FTR - I didn't write the wiki just updated with info when I implemented.
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT

Last edited by bcjenkins; 07-01-2008 at 07:17 PM.
Reply With Quote
  #6  
Old 07-03-2008, 03:28 AM
jhh jhh is offline
Sage Advanced User
 
Join Date: Nov 2003
Location: BE
Posts: 196
hi,

Thanks for all the replies on a topic I thought was somewhat obscure.

I've used SSH tunnel and it works but is not as elegant as reverse proxy; it does affect performance on streaming as well.

I hadn't seen the wiki but it is great - simply following the instructions got me a nice setup but like krikkit I found some limitations:

- streaming as krikkit identified

- multiple hosts - there are some challenges if you want /sage1 and /sage2 to point to 2 webservers if they are identical


Long version below:

I have http://smart-pvr:8081/test3/home which really is http://smart-pvr:8080/sage/home

Most things work but in the EPG TV Guide grid overview there are some issues. When I click on the first channel in the grid overview I have in the html source:

<a href="EpgChannel?&amp;startchan=91543" title="Channel Guide">

which translates to:

http://smart-pvr:8081/test3/EpgChannel?&startchan=91543

and that is correct - however when I click the page-up button in the source there is:

<a href="/sage/EpgGrid?&amp;startchan=91543" title="page up">

which doesn't do that much - I get:

http://smart-pvr:8081/sage/EpgGrid?&startchan=91543

while I should have gotten:

http://smart-pvr:8081/test3/EpgGrid?&startchan=91543


The simple solution is to have http://smart-pvr:8081/sage/home which really is http://smart-pvr:8080/sage/home - preserving the folder name but then it is difficult to differentiate multiple hosts.
Reply With Quote
  #7  
Old 07-03-2008, 06:46 AM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
Quote:
Originally Posted by jhh View Post
- multiple hosts - there are some challenges if you want /sage1 and /sage2 to point to 2 webservers if they are identical
Could you explain this a little more?
Quote:
Originally Posted by jhh View Post
Interesting. I guess I should try out this reverse proxy. I think the mobile web server is going to have that problem everywhere. It shouldn't be hard to change, though. Thanks for pointing it out.
Quote:
Originally Posted by jhh View Post
The simple solution is to have http://smart-pvr:8081/sage/home which really is http://smart-pvr:8080/sage/home - preserving the folder name but then it is difficult to differentiate multiple hosts.
So you'd basically be using port forwarding instead of reverse proxy?
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun.
Extender: STP-HD300, Harmony 550 Remote,
Netgear MCA1001 Ethernet over Coax.
SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client
, Java 1.6.
Plugins: Jetty, Nielm's Web Server, Mobile Web Interface.

Reply With Quote
  #8  
Old 07-03-2008, 07:37 AM
jhh jhh is offline
Sage Advanced User
 
Join Date: Nov 2003
Location: BE
Posts: 196
Quote:
Originally Posted by jreichen View Post
Could you explain this a little more?
I have 2 servers running the webserver: a headless underpowered one running 24/7 with SageTV as a service and a second one running in SageTV Client which has enough power to do transcoding which I switch on only when I need it. They are identical apart from IP and Port number and the problem is that drop down action gives a somewhat fixed URL.

-> because in: <a href="/sage/EpgGrid?&amp;startchan=91543" title="page up"> the /sage/ bit ends up in the URL I can only make it work when it is reduced to port forwarding as you concluded (probably my fault).

Only difference with the port forwarding that my router does is that 1 incoming port can be redirected to multiple local ones whereas my router does a one to one. (and I wanted to reduce the number of ports I require).

-> I've tried .../sage1/sage/home and a .../sage2/sage/home to differentiate between the 2 servers but on the page up linke in the EPG grid view that ended up in .../sage/EpgGrid.. and not .../sage1/sage/EpgGrid... so it is throwing away the ../sage1/ bit in this case. I know this must sound terribly confusing but it should be fairly easy to duplicate the problem.

Quote:
Originally Posted by jreichen View Post
Interesting. I guess I should try out this reverse proxy. I think the mobile web server is going to have that problem everywhere. It shouldn't be hard to change, though. Thanks for pointing it out.
I used a wamp server which has a pre-configured Apache to start from. Good enough for testing/playing. If you want I can send the httpd.conf - but it is almost a copy-and-paste from the wiki.

Jan
Reply With Quote
  #9  
Old 07-04-2008, 12:44 AM
mickp's Avatar
mickp mickp is offline
Sage Aficionado
 
Join Date: Oct 2006
Posts: 468
Given limited ip addresses for publishing internal http servers I'd normally opt for using different host headers (dns names) to differentiate between them. I normally use Microsoft ISA server for this which is not available for free. I'm sure that there's a way to do this with Apache as a reverse proxy though I have no experience with Apache.

Pros:

Can use the same port number for as many sites as you like with a single public IP.

No confusing port numbers or path translations. All can be on 80 if you desire.

Cons:

Can't use for multiple SSL sites because the host header cannot be discerned in the encrypted ssl requests.

LMK in the unlikely event that you have access to ISA Server you'd like a hand configuring it in this way.

Mick.
Reply With Quote
  #10  
Old 07-04-2008, 06:41 AM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
You can do this in Apache too (virtual servers).. Also if you need a free DNS provider check out http://www.dnsexit.com they offer free dynamic DNS updates for your own domain.

B
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT
Reply With Quote
  #11  
Old 08-03-2008, 05:48 PM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
I was looking at this a few weeks ago...

Did you try the Apache module (mod_proxy_html?) for URL rewriting? It parses the HTML pages and changes all the URLs based on the reverse proxy rules. I'm not crazy about it because it can have some side effects since it parses and reconstructs the HTML page and may not result in exactly what the developer had intended. It might be worth it for you to give it a shot and see what happens.

Is your reverse proxy on the same machine as nielm's web server? I installed Apache on a separate machine and it looks like the different server addresses in the headers causes redirects to fail (Set Watched, Set Don't Like, etc. redirect after submitting the command if JavaScript is disabled). There's a setting called ProxyPreserveHost that is supposed to modify the HTTP headers so basically the internal server has no idea it's being proxied. It didn't work on my server though. It might be a bug in Apache. The latest version of Jetty (the web server engine behind the mobile web interface) has a setting related to reverse proxying. I included the new version in the update to the plugin that I released today but haven't tried it out.

Lastly, installing and configuring Apache under Ubuntu is a little different. I have some steps written down, but haven't put them on the wiki since I never got the reverse proxy fully working.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun.
Extender: STP-HD300, Harmony 550 Remote,
Netgear MCA1001 Ethernet over Coax.
SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client
, Java 1.6.
Plugins: Jetty, Nielm's Web Server, Mobile Web Interface.

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web User interface link for the metadata file. zzmystique SageTV Customizations 0 06-21-2008 02:26 AM
Web User Interface + Secure = Broken Streaming Function jmoney579 SageTV Customizations 1 05-28-2008 01:51 AM
If I were in charge of re-designing SageTV..... stuckless General Discussion 39 04-18-2008 11:52 AM
Linkplayer, Linktheater with SageTV Web User Interface fyodor SageTV Customizations 0 10-08-2006 06:03 PM
Web UI/Webserver problem with proxy server rputman SageTV Customizations 4 03-17-2006 05:33 PM


All times are GMT -6. The time now is 12:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.