pigallery2 icon indicating copy to clipboard operation
pigallery2 copied to clipboard

Handle multiple app situation in traefik where pigallery is not using default 80 and root / path

Open kindadolf opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. In my docker-compose.yml. I already have an app that takes default traffic from port 80 and any path except specific paths reserved for other apps. Now I am adding pigallery to the collection of apps into the compose. I tried using different port such as 2342, or with prefix gallery. But neither of them was successful. In the port 2342 case, here is my config. But I ended up getting 404 error. docker-compose.yml:


docker
    environment:
      - PORT=2342
    labels:
      - "traefik.http.routers.pigallery2.rule=Host(`XXX.domain.com:2342`)"
      expose:
        - "2342"

traefik.yam

entryPoints:
  gallery:
    address: ":2342"

In the path prefix case, I set gallery as prefix. the main request XXX.domain.com/gallery is able to reach my pigallery service. But the issue is all the resources needed in the index.html for pigallery2 such as /assets/icon.png was not able to load (since they are not prefixed with gallery. Here is my setup in docker-compose.yml:

    labels:
      - "traefik.http.routers.pigallery2.rule=Host(`XXX.domain.com`) && PathPrefix(`/gallery`)"
      - "traefik.http.middlewares.stripgallery.stripprefix.prefixes=/gallery"
      # - "traefik.http.middlewares.stripgallery.stripprefix.forceSlash=true"  # I tried true and false, but I don't think it matters here
      - "traefik.http.routers.pigallery2.middlewares=stripgallery"

Describe the solution you'd like Given that the prefix route seems more promising. I would like to see if you can support this use case by setting an environment variable that will allow all the relatively referenced resources to be also prefixed with that environment variable. (Note: the actual resource should still reside in the same relative path without the prefix.)

kindadolf avatar Apr 30 '22 21:04 kindadolf

@kindadolf I cannot comment on the Traefik/Port issue, but regarding the /gallery prefix: Have you seen the Admin UI setting to set a Url Base? You have to switch to Advanced mode in the top right corner to see it.

I would expect that this setting fixes this problem, but haven't tested it.

grafik

tilmanginzel avatar May 01 '22 14:05 tilmanginzel

Thanks, @tilmanginzel, for the suggestion! That's good enough for me.

kindadolf avatar May 02 '22 07:05 kindadolf

Regarding to the ports: I haven't touched docker lately, but I think you are missing is to which port bind your inner port.

i.e.: https://github.com/bpatrik/pigallery2/blob/e3bc01e41b71dfc1b45094ef254110042bd51040/docker/docker-compose/default/docker-compose.yml#L11-L13 You would need to bind the inner port 80 to sometghing like 8080. eg:

    ports:
      - 80:8080
      - 443:4343

But these are just strong guesses, please read up on docker config.

bpatrik avatar May 14 '22 13:05 bpatrik

closing this due to inactivity

bpatrik avatar Dec 10 '22 00:12 bpatrik