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

Exposing UI only through Cloudflare Tunnel

Open hvmzx opened this issue 9 months ago • 3 comments

Hey, trying to deploy the ui/server on docker compose and it works well locally.

However, when exposing the UI through cloudflare tunnel to access it through my domain (just the UI, not the server as I don't want the server to be exposed), the UI is totally visible and works through stremio.domain.com, but the setup of the streaming server url doesn't work because the client (stremio.domain.com) is trying to access the server (which is local) instead of the UI's container.

It would be nice if the streaming url was directly resolved by the container itself rather than the client, especially here it makes the most sense as the ui and server are in the same container, so from the container UI's app, a ping to http://stremio-docker:11470 should be 100% possible.

Thanks in advance !

hvmzx avatar Mar 23 '25 15:03 hvmzx

I think this might be something you are looking for

https://github.com/tsaridas/stremio-docker/pull/75

its still under development.

tsaridas avatar Mar 23 '25 19:03 tsaridas

I think this might be something you are looking for

#75

its still under development.

Perfect, looking forward to this, it will be a huge update as one will not have to expose the server anymore and using container_name makes things easier and it is immutable so it will work no matter what the changes on the network are.

hvmzx avatar Mar 23 '25 23:03 hvmzx

@tsaridas I see that dev hasn't been merged with main yet, but I can test this on :nightly docker image ?

hvmzx avatar May 09 '25 18:05 hvmzx

@hvmzx PR was merged to master and pushed to docker hub. Please let me know if all is working for you.

tsaridas avatar Jun 30 '25 08:06 tsaridas

this works perfectly, thanks !

hvmzx avatar Jun 30 '25 11:06 hvmzx

@tsaridas Just tested it again but this time on my phone and it doesn't work, the server is not recognised with "http://localhost:11470". Maybe in that case it's trying to resolve client-side not container-side ? But that worked on my PC browser so not entirely sure.

Would be nice if the container was resolvable as "http://stremio:11470" as well, to avoid any conflict with client-side.

hvmzx avatar Jul 01 '25 19:07 hvmzx

@hvmzx localhost is a special DNS name that always resolves to the same machine the application is running on. By default, it maps to:

127.0.0.1   localhost
::1         localhost

So if you access your web application from another device using an address like 192.168.1.2:8080 and then configure the server to localhost, your browser will try to connect to itself, not the remote device — because localhost always refers to the local system.

Since I’m not sure where your container is running, I can’t tell exactly what you’re trying to connect to. But in general:

If you need to connect to a remote IP, you must use a real IP address or hostname

This container does not act as a DNS server, so name resolution across devices must be handled by your network's DNS or via the hosts file

To simplify setup, you can use the environment variable:

-e AUTO_SERVER_URL=1

This automatically configures the correct server URL based on how the app is accessed.

tsaridas avatar Jul 01 '25 20:07 tsaridas

@tsaridas Basically what I am doing right now is exposing only the UI, hosted on my server, and wanted the webui accessed through stremio.domain.co on any of my devices to have access to the stremio-server (without using exposition and assigning a public domain to it or anything)

I tried that env var and it didn't help

hvmzx avatar Jul 01 '25 22:07 hvmzx

Im not sure what you mean with UI and webui and what’s the difference. You need to better explain your setup.

Are you using certificates or not ?

How does the docker compose file look like?

what doesn’t work exactly?

Please read the documentation I have provided.

tsaridas avatar Jul 02 '25 12:07 tsaridas

Basically got the following compose. Exposing only the port 8080 (webui) not the server on 11470. What I had before and that worked was also exposing 11470 externally but I would prefer avoiding that.

  stremio:
    image: tsaridas/stremio-docker:latest
    container_name: stremio
    expose:
      - 8080   # Frontend (Web Player)
      - 11470  # Backend (Server HTTP)
    restart: unless-stopped
    environment:
      - AUTO_SERVER_URL=1
      - NO_CORS=1
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.stremio.rule=Host(`stremio.domain.com`)"
      - "traefik.http.routers.stremio.entrypoints=websecure"
      - "traefik.http.routers.stremio.tls.certresolver=letsencrypt"
      - "traefik.http.routers.stremio.middlewares=authelia@docker"
      - "traefik.http.routers.stremio.service=stremio"
      - "traefik.http.services.stremio.loadbalancer.server.port=8080"

hvmzx avatar Jul 02 '25 17:07 hvmzx

You do not need - 11470 # Backend (Server HTTP) with the new container. This way you have http so no certificates are generated which also means you cannot access the server from any web player which is not http or that it has https (certificates generated).

You should be able to access the web player on port 8080 with the ip of your container and server will automatically be setup for you.

tsaridas avatar Jul 03 '25 12:07 tsaridas

Thanks, works now without that port exposition. Thanks !

hvmzx avatar Jul 03 '25 20:07 hvmzx