Routing paths with Traefik

后端 未结 2 1949
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-18 22:12

Currently I\'m trying set up a loadbalancer/reverse proxy with Traefik for some docker containers. I\'m having trouble with configuring Treafik to make my apps available usi

2条回答
  •  感情败类
    2020-12-18 23:00

    This morning I found the solution. The correct approach in cases like these should be to use the PathPrefixStrip rule. However, as mentioned here, putting a / at the end of the rule will break the setup. I created a working configuration by removing / at the end of the PathPrefixStrip: /portainer4/ rule. So this docker-compose configuration worked for me:

    version: '2'
    
    services:
      traefik:
        container_name: traefik2
        image: traefik
        command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
        ports:
          - "80:80"
          - "8081:8080"
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - /dev/null:/traefik.toml
        labels:
            - "traefik.enable=false"
      portainer:
        image: portainer/portainer
        labels:
          - "traefik.backend=portainer"
          - "traefik.frontend.rule=PathPrefixStrip: /portainer"
    

    Now when I navigate to /portainer/ I see the portainer page. I do, however, still get the white page as mentioned earlier when I navigate to /portainer.

提交回复
热议问题