IPTV streams - how to configure via a transparent proxy
Added by Alasdair Thomson about 6 years ago
Hi - having a hard time getting a solution here to a problem that is bugging me... I have three IPTV providers, one of which needs to go via a VPN for some access restrictions. I have the VPN running on a separate machine with a transparent squid http proxy. This all works great via VLC. However struggling to get a solution to configure tvh on Ubuntu 16.04 to use the proxy. Some ideas and things I have tried
1. Messing about with iptables for the specific port in question
2. Pipe to ffmpeg and use the -http_proxy option
I didn't get very far with iptables but i think ffmpeg pipe could work except it seems fine with http_proxy environment variable but won't take it as a command line parameter. I would prefer to specify this in the m3u file so all IPTV networks don't use the proxy.
If I did have to use an environment variable, what is best way to set it for the hts user only?
Any ideas and help much appreciated... thanks in advance!
Replies (5)
RE: IPTV streams - how to configure via a transparent proxy - Added by ermos jevohan about 6 years ago
Hello,
I have tested haproxy
with 14.04 and 18.04 bionic. Both work nice.
I do not think that there is a major difference when we give it a go on 16.04
Do not know why you need to set iptables
, firewall? If you wish to allow users running at certain ip addresses, Tvheadend has its own iptables
rules in user field.
Regards
Ermos
RE: IPTV streams - how to configure via a transparent proxy - Added by Alasdair Thomson about 6 years ago
Thanks Ermos - how did you configure haproxy to work with tvheadend?
My idea around the iptables was to do something like this --> [[https://stackoverflow.com/questions/10727443/how-to-use-iptables-in-linux-to-forward-http-and-https-traffic-to-a-transparent]]
RE: IPTV streams - how to configure via a transparent proxy - Added by ermos jevohan about 6 years ago
Here you are:
In main server:
apt-get install haproxy -y
in /etc/init.d/haproxy
change
enabled=0
to
enabled=1
If you do not have "enabled=0" line, add "enabled=1"
then, edit your /etc/haproxy/haproxy.cfg as below:
global
log 127.0.0.1 local0 notice
maxconn 2000
user haproxy
group haproxydefaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
timeout connect 5000
timeout client 10000
timeout server 10000listen myapp
bind 0.0.0.0:33333
mode http
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth define_a_username:define_a_password
balance roundrobin
option httpclose
option forwardfor
server server2name server2_ip:9981
server server3name server3_ip:9981
restart your haproxy:/etc/init.d/haproxy restart
In VLC:
http://main_server_ip:33333/playlist
Kind regards
Ermos
RE: IPTV streams - how to configure via a transparent proxy - Added by Alasdair Thomson about 6 years ago
Ermos,
Thanks for your help... however as per our email discussion, your solution using haproxy is solving for a different problem than my one where you are seeking to distribute load from a front-end server to 2 back end tvheadend servers.
Anybody else got any ideas?
Thanks
RE: IPTV streams - how to configure via a transparent proxy - Added by Alasdair Thomson about 6 years ago
Having some success with proxychains in case anybody cares... will report back once have it nailed