warren-bank / HLS-Proxy

Node.js server to proxy HLS video streams

Home Page:http://webcast-reloaded.surge.sh/proxy.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proxy configured to be on a domain, the port blocks further requests

alekorhonen opened this issue · comments

commented

I've setup the proxy to run on port 8080 and the host is targeted at a subdomain.

I can nicely load the manifest file, but every url that it points to after that includes the port in the URL. So instead of proxy.mydomain.com it becomes proxy.mydomain.com:8080 which is an invalid request.

I did a really dirty workaround for now, which was that I modified the host value in start_http.js just to replace the :8080 out of there.

Hi. I don't understand your situation.

Are you running the proxy at: http://proxy.mydomain.com:8080?

What are some example URLs for:

  • master manifest
  • child manifest (in master)
  • ts video file (in child)

What are the encoded URLs (directed through proxy) for each example?
How are they incorrect for your situation?

The fact that the proxy encodes the URLs it finds within manifests is intended to redirect those URLs through the proxy, which (in your example) is listening at port 8080. To remove this port would make the URLs default to port 80.. which wouldn't reach the proxy; you may have another httpd listening on 80, but it wouldn't understand the base64 encoded URL path.

commented

Yes, I am running the proxy at http://proxy.mydomain.com:8080. I have a reverse proxy setup for the subdomain through nginx that points to that port (8080) so that I can setup authentication layer on top of the hls proxy, if that makes sense.

Now the master manifest loads fine when I request it, but all the urls contained in the master manifest include the port in the url, which is what I do not want in there because the url's are invalid in my case and will not point anywhere.

Let's say we load the master manifest at first
http://proxy.mydomain.com/<BASE64>.m3u8

After loading the master manifest, all the url's in there point to http://proxy.mydomain.com:8080/ instead of http://proxy.mydomain.com/.

now, my understanding is that..

the public facing server is located at:

  • host = proxy.mydomain.com
  • port = 80

and you've configured this server (after proper authentication) to reverse proxy (conceptually similar to a URL redirect) all requests for all paths to:

  • host = <IP for instance of HLS-Proxy, reachable by reverse proxy>
  • port = 8080
  • note = IP:8080 is behind a firewall and cannot be accessed directly by the general public, only through the reverse proxy

This code is relevant to your situation. The code comments speak to your exact situation, which probably never bubbled up to become visible in the README. The solution is that when you start the proxy server on the command-line, you embed the public facing port number in the host option. For example, --host "proxy.mydomain.com:80" --port 8080

Please give this a try, and let me know if it solves your situation. Thanks.