rtp2httpd icon indicating copy to clipboard operation
rtp2httpd copied to clipboard

反向代理域名带端口访问过程中playlist.m3u会端口号被自动删除的问题,导致无法正常观看

Open 7161457 opened this issue 7 months ago • 1 comments

你好,我是在群辉nas中使用docker搭建的服务,m3u源使用的是 https://github.com/plsy1/iptv 提供的单播rtp2httpd链接.在内网192.168的使用过程中一切正常,当我在使用npm反向代理的时候,出现一个问题,由于国内公网ip的443和80端口是封禁的,反向代理443端口和80端口是不通的,所以我使用的是其他端口,例如4430端口,这样网址就变成了https://iptv..cn:4430/player ,但是实际生成的playlist.m3u会把端口省略掉,例如https://iptv..cn:4430/%E5%A4%AE%E8%A7%86%E9%A2%91%E9%81%93/CCTV1 会变成 https://iptv.*****.cn/%E5%A4%AE%E8%A7%86%E9%A2%91%E9%81%93/CCTV1 ,导致无法无法正常观看,因为我在使用vlc测试的时候,加上端口就可以正常观看了,请帮忙修复这个问题playlist.m3u不要删除域名带的端口,

Image Image Image

7161457 avatar Apr 16 '26 12:04 7161457

通过读取这个代码 https://github.com/stackia/rtp2httpd/blob/main/src/connection.c 得知域名读取的方式m3u_generate_playlist( hostname, x_forwarded_host, x_forwarded_proto );,然后修改了npm反代直接传递端口解决,给其他朋友一个参考办法,

Image

location / { proxy_pass http://192.168.1.6:5140/; proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Origin $scheme://$http_host; proxy_set_header Referer $scheme://$http_host/;

}

谢谢,可以关闭问题了.

7161457 avatar Apr 16 '26 13:04 7161457