Routing paths with Traefik

醉酒当歌 提交于 2019-12-01 03:56:41

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 <myIP>/portainer/ I see the portainer page. I do, however, still get the white page as mentioned earlier when I navigate to <myIP>/portainer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!