Project

General

Profile

Bug #4372

ProxyPass (apache) no working anymore

Added by Dirk Diggler over 7 years ago. Updated almost 3 years ago.

Status:
Invalid
Priority:
Normal
Assignee:
-
Category:
Configuration
Target version:
-
Start date:
2017-05-13
Due date:
% Done:

0%

Estimated time:
Found in version:
4.3
Affected Versions:

Description

Hi,

i use a ProxyPass configuration to redirect to myserver:9981 web gui.
I updated from 4.0 to 4.3 and the page now shows blank white. (But it's asking for credentials before)

Please fix!
DocMAX

History

#1

Updated by Jaroslav Kysela over 7 years ago

It works with properly configured nginx and it should work with apache, too. Could you test this?

Q: Access Tvheadend through HTTP proxy

Use '--http_root' directive to specify the alternative http webroot (initial
path prefix). The proxy server MUST pass this webroot path in the HTTP
request, otherwise an access to the Tvheadend server will end with
the endless redirect loop.

Example for nginx (--http_root=/my/tvh/server):

location /my/tvh/server {
  proxy_pass http://1.1.1.1:9981;
}

Example for apache (--http_root=/my/tvh/server):

ProxyPass "/my/tvh/server" "http://1.1.1.9981/my/tvh/server";
#2

Updated by Pablo R. over 7 years ago

For nginx isn't better to use that?

location /my/tvh/server {
  proxy_pass http://1.1.1.1:9981;
  proxy_set_header  X-Real-IP  $remote_addr;
  proxy_set_header  Host  $http_host;
}

I had problems without that headers.

#3

Updated by Dirk Diggler over 7 years ago

OK, http_root did the trick. Thank you.

#4

Updated by Jaroslav Kysela over 7 years ago

Pablo Rodríguez wrote:

For nginx isn't better to use that?
[...]
I had problems without that headers.

Yes, sure, I focused only on proxy_pass line, the other headers are also mandatory to make things to work.

#5

Updated by Jaroslav Kysela over 7 years ago

  • Status changed from New to Invalid
#6

Updated by Dirk Diggler almost 7 years ago

Still having problems with new version.
My config:

OPTIONS="-u hts -g video -6 --http_port 9981 --htsp_port 9982 --http_root /tv"

Apache:
ProxyPass /tv http://htpc.lan:9981/tv

While http://htpc.lan:9981/tv works fine i get {"type":"ApiError","message":"HTTP 404 Not Found"} on webserver.

#7

Updated by Mono Polimorph almost 7 years ago

Dirk Diggler wrote:

Still having problems with new version.

Hi,

If you use "nginx" as the proxy, then you can use this:

server {
                proxy_protocol on;
                ...
}

And if you use "Apache", then configure and enable the PROXY PROTOCOL module:
http://roadrunner2.github.io/mod-proxy-protocol/mod_proxy_protocol.html

Then, inside the TVH you only need to configure the PROXY PROTOCOL support, enabling "Use PROXY protocol & X-Forwarded-For" in General Config (Base). Enabling this, all HTTP and RTSP listening ports will accept the PROXY protocol.

Futhermore, I suggest to Jaroslav to commit the patch of the issue #4748 for showing in the UI which connections use the PROXY protocol.

Regards.

#8

Updated by Dirk Diggler almost 7 years ago

Can we try without ProxyProtocol please?

Since some version i only get the EPG tab. (Going directly to the tvheadend server i get all the tabs).

In log i can see the following:

http: ::ffff:192.168.1.1: HTTP/1.0 GET /tv/comet/ws -- 415

#9

Updated by Dave Pickles almost 7 years ago

Dirk Diggler wrote:

Since some version i only get the EPG tab. (Going directly to the tvheadend server i get all the tabs).

In log i can see the following:

http: ::ffff:192.168.1.1: HTTP/1.0 GET /tv/comet/ws -- 415

I've recently had the same problem. What worked for me (using Apache) was to add the following to httpd.conf:

ProxyRequests Off
<Location "/tvh2/comet/ws">
ProxyPass ws://x.x.x.x:9981/tvh2/comet/ws/
ProxyPassReverse ws://x.x.x.x:9981/tvh2/comet/ws
</Location>
<Location "/tvh2">
ProxyPass http://x.x.x.x:9981/tvh2
ProxyPassReverse http://x.x.x.x:9981/tvh2
</Location>

and also enable the ws-proxy module. However even with these changes, Firefox wouldn't display all the tabs. Konqueror worked; I didn't check any other browsers.

#10

Updated by Dirk Diggler almost 7 years ago

That worked! Thank you very much! @Dave

#11

Updated by Dirk Diggler almost 7 years ago

@Dave, may i ask you how did you "debug" this and found the solution? Did you use logs or tcpdumps or anything?

#13

Updated by rpluto . about 6 years ago

I found this two topics

This one submited as bug and another one as forum discussion
Link above

There i put my solution for apache reverse proxy.

How ...

Base on the settings from ngix.

For apache is need more than

the Proxy and the reverse

And base on this is need some rewrite
https://stackoverflow.com/questions/22002744/how-to-set-up-an-apache-proxy-for-meteor-sockjs-and-websocket

So after that my reverse proxy is ok

Settings

  ProxyPass /tvheadend http://localhost:9981
  ProxyPassReverse /tvheadend http://localhost:9981
  ProxyPass /tvheadend/comet/ws ws://localhost:9981/comet/ws
  ProxyPassReverse /tvheadend/comet/ws ws://localhost:9981/comet/ws
<Location /tvheadend/comet/ws>
        RewriteEngine on
        RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
        RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
        RewriteRule .* ws://192.168.25.5:9981/comet/ws [P]
 </Location>

Notes:
I dont use any --http_root

#14

Updated by rpluto . about 6 years ago

because i dont use --http_root i also need this one

ProxyPass /static/ http://localhost:9981/static/
ProxyPassReverse /static/ http://localhost:9981/static/

And here

#15

Updated by Giovanni Russo almost 3 years ago

I have error 404 not found

i always used and ran my apache proxy with tvheadend on pios raspbian with the "/tvheadend"

directive set in "/etc/default/tvheadend"

in the directive: TVH_HTTP_ROOT = "/tvheadend"

my conf file contains the following entries:

ProxyPreserveHost On
ProxyRequests off

ProxyPass /tvheadend/ http://192.168.6.78:9981/tvheadend/

ProxyPassReverse /tvheadend/ http://192.168.6.78:9981/tvheadend/

Pios raspbian has upgraded to bullseye and from now on i get 404 error not found. i tried to enable proxy entry in gui and reinstall but i can't see gui. what can I do?

#16

Updated by saen acro almost 3 years ago

What happens when change

ProxyPass /tvheadend/ http://127.0.0.1:9981
ProxyPassReverse /tvheadend/ http://127.0.0.1:9981

#17

Updated by Giovanni Russo almost 3 years ago

the problem that tvheadend resides on another raspberry that has ip 192.168.6.78,

if I call it without the path "/ tvheadend" in this way

ProxyPass /tvheadend/ http://192.168.6.78.1:9981                            
ProxyPassReverse /tvheadend/ http://192.168.6.78:9981

I access but the cards do not come out

blank page but no tabs appear

#18

Updated by Giovanni Russo almost 3 years ago

ProxyPass /tvheadend/ http://192.168.6.78:9981/
ProxyPassReverse /tvheadend/ http://192.168.6.78:9981/

I access but the cards do not come out

blank page but no tabs appear

#19

Updated by Giovanni Russo almost 3 years ago

I use url

https://mo××××.duckdns.org/tvheadend

with tvheadend updated to 4.2.4 buster everything worked, with debian bullseye updated to 4.3-1994

i started having this problem
#20

Updated by Giovanni Russo almost 3 years ago

i solved it by myself as i understand that at least in this version the variable

"TVH_HTTP_ROOT =" / tvheadend "

it is not called back and I don't know why

then I had to always recall it in the same file under OPTIONS

OPTIONS = "- u hts -g video --http_root / tvheadend"

and I don't understand why the path validates them and on HTTP_ROOT no.

in addition on my apache proxy I had to enable the web socket call and with or without the PROXY protocol & X-Forwarded-For checkbox in the GUI everything works

ProxyPass /tvheadend/comet/ws ws://192.168.6.78:9981/tvheadend/comet/ws
ProxyPassReverse /tvheadend/comet/ws ws://192.168.6.78:9981/tvheadend/comet/ws
ProxyPass /tvheadend http://192.168.6.78:9981/tvheadend
ProxyPassReverse /tvheadend http://192.168.6.78:9981/tvheadend

Greetings

Also available in: Atom PDF