Stremio / server-docker

Builds and publishes Docker image for new releases of server.js
GNU General Public License v2.0
123 stars 22 forks source link

Allow Enabling HTTPS with ENV Var #8

Open jaruba opened 1 year ago

jaruba commented 1 year ago

The server is able to create valid SSL certificates given a LAN IP, but there is no way to set this outside of the Stremio app settings. (when connected to the server)

I propose creating an env var (could be named "REMOTE_HTTPS") that should be set to the LAN IP address in order to provide an SSL certificate for it.

The HTTPS server uses the 12470 port, while the HTTP server uses the 11470. (only 11470 is currently being exposed in this docker image, I believe)

elpiel commented 1 year ago

I've already added the 12470 port to the Dockerfile, however, keep in mind that this is for documentation purposes, you still have to expose the port when running the container:

docker run --rm -d -p 11470:11470 -p 12470:12470 stremio/server:latest

See PR #13 https://github.com/Stremio/server-docker/blob/feat/multiplatform-builds/Dockerfile#L57-L58

damacchi commented 1 year ago

I get HTTPS: Request error Could not get a valid HTTPS certificate in the container logs (on a different computer on the same lan) whenever i hit reload in the webapp streaming settings.

vpetkovic commented 1 year ago

Is this issue a reason why connection to the server fails unless it is exposed publicly over https (ex: https://stremio.domain.com)?

Weird thing is when trying to set my server to point to 'http://192.168.1.2:11470' or 'https://192.168.1.2:12470' it fails to connect, but if I copy stream URL ( #19 ) and replace the malformed IP with aforementioned LAN IP video loads and plays,

manueljishi commented 7 months ago

I get HTTPS: Request error Could not get a valid HTTPS certificate in the container logs (on a different computer on the same lan) whenever i hit reload in the webapp streaming settings.

@damacchi I am currently having the same issue, did you manage to fix it? Thank you very much

kennyparsons commented 3 months ago

I think there's an undocumented (or hard to find) endpoint that generates the certs or i think you need to just put self signed certs in the settings directory. PEM file, i think. proto://localhost:11470/get-https

tompipe commented 2 months ago

I think there's an undocumented (or hard to find) endpoint that generates the certs or i think you need to just put self signed certs in the settings directory. PEM file, i think. proto://localhost:11470/get-https

I had to ensure the ipAddress was set in the query string for this to work. e.g

http://<local docker host ip>:11470/get-https?ipAddress=<local docker host ip>

This then returned some json, e.g:

{
  ipAddress: "<local docker host ip>",
  domain: "<local docker host ip>.519b6502d940.stremio.rocks",
  port: 12470
}

And created a httpsCert.json in the data dir with matching details.

The domain it returns has an A record pointing to <local docker host ip>.

Accessing it in a browser redirects to app.strem.io with the correct streamingServer query string passed, and https certs all seem to be working