Hello,
I'm new to traefik. I'm using Traefik on Docker swarm as reverse proxy for my service in my home LAN server. One of the service is Portainer.
traefik service
version: "3.2"
networks:
traefik_public:
external: true
services:
proxy:
image: traefik:v2.9.6
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
restart_policy:
condition: on-failure
delay: 30s
max_attempts: 3
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik_public"
- "traefik.http.routers.api.rule=Host(`192.168.0.120`) && PathPrefix(`/dashboard`) || Host(`192.168.0.120`) && PathPrefix(`/api`)"
- "traefik.http.routers.api.entrypoints=https"
- "traefik.http.routers.api.tls=true"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.services.dummy.loadbalancer.server.port=9999"
env_file:
.env
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
published: 443
protocol: tcp
mode: host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/etc/traefik
networks:
- traefik_public
Here is my portainer service
version: '3.2'
networks:
traefik_public:
external: true
volumes:
portainer_data:
secrets:
portainer_admin_password:
file: ./secrets/portainer_admin_password.txt
services:
portainer:
image: portainer/portainer-ce:linux-arm64-2.17.0-alpine
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
restart_policy:
condition: on-failure
delay: 30s
max_attempts: 3
labels:
- traefik.enable=true
- traefik.docker.network=traefik_public
- "traefik.http.routers.portainer.tls=true"
- "traefik.http.routers.portainer.rule=PathPrefix(`/portainer`)"
#- "traefik.http.middlewares.portainer.replacepath.path=/"
- "traefik.http.middlewares.portainer.stripprefix.prefixes=/portainer"
#- "traefik.http.middlewares.portainer.stripprefix.forceSlash=false"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
hostname: portainer
command:
- -H
- unix:///var/run/docker.sock
- --admin-password-file=/run/secrets/portainer_admin_password
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
networks:
- traefik_public
secrets:
- portainer_admin_password
Getting 404 page not found
For here I found
Use a
StripPrefix
middleware if your backend listens on the root path (/
) but should be exposed on a specific prefix.
I'm quite not sure what is the issue. Any help would be appreciated