warren-bank / HLS-Proxy

Node.js server to proxy HLS video streams
http://webcast-reloaded.surge.sh/proxy.html
GNU General Public License v2.0
238 stars 68 forks source link

Using HTTPS - key/cert file #13

Closed asheroto closed 2 years ago

asheroto commented 2 years ago

Hi there,

First off - thanks so much for this project! It comes in very handy! 👍💯

Can you kindly provide an example of how to pass a key/cert for HTTPS?

I need to use --req-options and give it a filename of a JS file that modifies the options object, right?

I'm trying...

--tls --host "myhost.hostname.com:443" --port "3005" --req-options "/path/to/the/file/options.js"

And in options.js I have...

var options = {
  key: fs.readFileSync('/path/to/privkey.pem'),
  cert: fs.readFileSync('/path/to/cert.pem')
};

I think I missing something though, as this does not work?

Thank you very much. :-)

asheroto commented 2 years ago

I ended up just symlinking the certs in hls-proxy/servers/cert but am curious if this can be done anyhow? :-)

warren-bank commented 2 years ago

sorry for the delay.. I was focused on a different project.. bad timing to come up for air.

anyway.. I had to take a peek at the code to answer your question.. and the answer is: I never exposed any cli options to customize the path to certificate files.

strictly speaking.. I should probably add: --tls-key --tls-cert and (an optional) --tls-pass

but, given the current coding.. what you did is fine; the other workaround would be to manually update the code here.. and hard-code your own paths.

PS: --req-options aren't used to configure the proxy server.. these values are used to configure the HTTP requests that are made to the video server(s)

warren-bank commented 2 years ago

ok.. I just gave this repo a little attention; v0.19.0 adds the new cli options that will allow you to use your own certificate: --tls-cert, --tls-key, and (an optional) --tls-pass

asheroto commented 2 years ago

Awesome, thanks for the info!