server-docker icon indicating copy to clipboard operation
server-docker copied to clipboard

Https is not properly detected

Open lohmatij opened this issue 1 year ago • 9 comments

I serve stremio server behind a reverse-proxy with https

My server is available at: https://stremio.server.com

if I open app.strem.io and specify https://stremio.server.com/ as my server then everything works perfectly

if I open https://stremio.server.com/ then the server is pre-populated to http://stremio.server.com/ (http instead of https) and the app doesn’t work.

If it’s not possible to detect http/https then I suggest to add a separate environment setting to provide a proper url.

lohmatij avatar Nov 10 '24 19:11 lohmatij

Which port did you forward to your reverse proxy? I think you need to forward the https port (12470) instead of the http port (11470) to ensure that the auto redirect. works.

This will probably also require you to skip the tls verify in your reverse proxy. Alternatively, you can generate the tls cert with the /get-https?ipAddress=<ip_address> route and use the self-signed certificate with the wildcard domain (*.519b6502d940.stremio.rocks). Replace * with your ip address (192-168-0-2, with dots replaced with dashes).

Alternatively, use this other docker image which has everything assembled. tsaridas/stremio-docker

As an example, this is in my Caddyfile. I am not familiar with other reverse proxy, so will not be able to help you.

	@stremio host stremio.{$DOMAIN}
	handle @stremio {
		reverse_proxy https://stremio:12470 {
			transport http {
                                # to use https transport to stremio container
				tls_server_name 192-168-0-2.519b6502d940.stremio.rocks
                                # alternatively to skip tls cert check
                                # tls_insecure_skip_verify
			}
		}
	}

The streaming server shows "Online" in my setup, but still jumps to "Error" at times, so I am not confident my configuration is working 100%.

yxtay avatar Nov 11 '24 02:11 yxtay

I have the same issue and I don’t want to use stremio https port as there is no need for tls between traefik and stremio. Reverse proxies set X-Forward-Protocol header precisely for this case, the redirect code should check it too, not only which port it came from

I’ve tried looking for server.js GitHub to open PR but I cannot find it. Where is it?

fopina avatar Dec 31 '24 02:12 fopina

I believe it comes from here.

https://github.com/Stremio/stremio-service/blob/master/src/server.rs

yxtay avatar Dec 31 '24 03:12 yxtay

Does it? Using default port 11470 as a random search criteria, I don’t find it mentioned in that repo, it doesn’t look the same as that server.js Also, there’s no workflow or doc saying how to build the wasm js in the repo. And, if it was that service, why use a wasm JS file in this repo (docker) when you can just use the rust binary…?

fopina avatar Dec 31 '24 18:12 fopina

I'm not familiar. The following issue also discussed the sources

#27

yxtay avatar Jan 01 '25 07:01 yxtay

Thank you! I’ll follow up on that one

fopina avatar Jan 01 '25 19:01 fopina

More related to this one than #27 so posting it here: I've applied a small patch to server.js when building docker image, this one to also consider the X-Forward-Proto header.

Not sure how to submit such changes/requests to this file..

fopina avatar Jan 03 '25 00:01 fopina

@elpiel how do I submit/suggest the patch to server.js? (as you confirmed it’s closed source in #27 )

fopina avatar Aug 06 '25 22:08 fopina

Since I'm not the one developing the server, I've proposed this to the dev. responsible for it. Waiting for his comment on the addition, otherwise, I can add the change myself. I already found the location of the code.

elpiel avatar Aug 07 '25 06:08 elpiel