Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Enabling HTTPS with ENV Var #8

Open
1 of 2 tasks
jaruba opened this issue Jun 6, 2023 · 7 comments
Open
1 of 2 tasks

Allow Enabling HTTPS with ENV Var #8

jaruba opened this issue Jun 6, 2023 · 7 comments

Comments

@jaruba
Copy link
Member

jaruba commented Jun 6, 2023

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)

  • Expose port 12470
  • Add env. variable for remote https ssl certificate
@jaruba jaruba changed the title Allow HTTPS Features Allow Enabling HTTPS with ENV Var Jun 6, 2023
@elpiel
Copy link
Member

elpiel commented Jun 26, 2023

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
Copy link

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
Copy link

vpetkovic commented Sep 2, 2023

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
Copy link

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
Copy link

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
Copy link

tompipe commented Sep 7, 2024

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

@Opinion
Copy link

Opinion commented Nov 23, 2024

I believe I found a way to persist the SSL certificate. Here is what I did:

I added /root/.stremio-server as a volume;

    volumes:
      - ${CONTAINER}/server:/root/.stremio-server

Restarted the container and generated the SSL certificate like @tompipe mentioned;

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>

In my case: http://192.168.1.69:11470/get-https?ipAddress=192.168.1.69


I also got it working behind a reverse proxy; using nginx-proxy manager with Let's Encrypt certificates.
For this, I recommend owning a domain and adding '*.local' and 'local' as A records pointing to the LAN IP of your server.

  • A *.local 192.168.1.69
  • A local 192.168.1.69

Here are my proxy host settings:

[TAB: Details]
Domain Names:           stremio.local.example.com
Scheme:                 https
Forward Hostname / IP:  192.168.1.69
Forward Port:           12470
Websocket Support:      (checked)

[TAB: SSL]
SSL Certificate:        Request a new SSL Certificate
Force SSL:              (checked)
Use DNS challenge:      (checked)
DNS Provider:           *select your provider and API settings*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants