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

how to multiple domains? (localhost, IP, domain) #13

Closed
saul-salazar-dotcom opened this issue Dec 26, 2024 · 4 comments
Closed

how to multiple domains? (localhost, IP, domain) #13

saul-salazar-dotcom opened this issue Dec 26, 2024 · 4 comments

Comments

@saul-salazar-dotcom
Copy link

Hi,

Is is possible to have multiple domains? for example I want to be able to access erin in 3 ways:

  • with my local IP (192.168.100.10)
  • with localhost
  • with a custom domain (tiktok.homelab.com)

but it seems like I only can choose one

Right now I want another people to access erin in my local network, so I had to set the env var PUBLIC_URL to http://192.168.100.10:3333 but now I cannot access via localhost:3333

But I want to access via tiktok.homelab.com but only on my LAN, so I added traefik proxy to help with that but it doesnt work :(

I have 10 applications via docker compose and I expose them via Traefik and a local https certificate (thanks to mkcert.dev), I only add a few labels and it works OK on all applications except erin, this is my current docker-compose.yaml file

name: tiktok

networks:
  proxy:
    external: true

services:
  erin:
    image: mosswill/erin:latest
    ports:
      - "3333:3333"
    volumes:
      - "/e/videos/:/srv/videos:ro"
    networks:
      - proxy
    environment:
      PUBLIC_URL: "http://192.168.100.10:3333"
      AUTH_ENABLED: "false"
      AUTOPLAY_ENABLED: "true"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`tiktok.homelab.com`)"
      - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.entrypoints=https"
      - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.tls=true"
      - "traefik.http.services.${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=3333"
@will-moss
Copy link
Owner

will-moss commented Dec 26, 2024

Hi !

Thanks a lot for opening the issue and providing all those details.

I'm not entirely sure that Erin supports multiple domains at once, but I think we could try still.

May I suggest that, in the "PUBLIC_URL" variable, you set only ":3333" and see if that works?

I have checked the documentation of Caddy (the server that Erin is built on top of), and I think that ":3333" is enough to instruct the server to accept all the requests, so long as they come on port 3333, regardless of the hostname.

Let me know if that works, and else, I think I can adjust the code for your use case.

Side note : I haven't used Traefik in a long time, but I think you should also update your rule with an "OR" condition to accept different hosts, no? Like Host('X') || Host('Y') || Host('Z').

@saul-salazar-dotcom
Copy link
Author

Hi @will-moss, thanks for your response

With ":3333" now I can access with localhost:3333 and my local IP address, thank you very much!

Now when I access tiktok.homelab.com it loads the application but it doesnt show any videos.
Using the dev tools I can see a http request to the URL https://tiktok.homelab.com/:3333/media/?hash= which returns the same HTML im seeing with the error message, but If I remove the :3333/ I can see a list of my videos and I can see them manually

I think its because of the following script on the index.html page:

        <script>
            window.PUBLIC_URL = ":3333",
            window.USE_SECRET = false,
            "https:" === window.location.protocol && (window.PUBLIC_URL = window.PUBLIC_URL.replace("http:", "https:")),
            window.AUTOPLAY_ENABLED = true,
            window.PROGRESS_BAR_POSITION = "bottom"
        </script>

It is possible to change the index.html template from window.PUBLIC_URL = "__PUBLIC_URL__"; to window.PUBLIC_URL = window.location.href?

will-moss added a commit that referenced this issue Dec 26, 2024
will-moss pushed a commit that referenced this issue Dec 26, 2024
## [1.12.5](v1.12.4...v1.12.5) (2024-12-26)

### Bug Fixes

* **client:** changed the way the public url is built on the client to make it more flexible ([e48813e](e48813e)), closes [#13](#13)
@will-moss
Copy link
Owner

Alright, thanks a lot for reporting back, and I'm glad this works better already.

I have just published a new release that should (hopefully) fix everything.

You can pull the latest image and tell me if that solves it!

PS : I used window.location.origin because the client needs the root address, while href would include the path too. Thanks a lot for the recommendation, you rock 👍

@saul-salazar-dotcom
Copy link
Author

Hi @will-moss, thank you very much for the update!! its working perfectly :D

you make good apps, I just discovered the isaiah project and Im going to add it to my homelab :D thanks a lot!!!

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

2 participants