# 404 when using PathPrefix with docker swarm

**URL:** <https://community.traefik.io/t/404-when-using-pathprefix-with-docker-swarm/8091>\
**Category:** Traefik v2\
**Tags:** docker-swarm\
**Created:** [October 7, 2020, 1:04pm UTC](https://community.traefik.io/t/404-when-using-pathprefix-with-docker-swarm/8091 "2020-10-07T13:04:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidsbond](https://avatars.discourse-cdn.com/v4/letter/d/cc9497/32.png) [@davidsbond](https://community.traefik.io/u/davidsbond)\
**Post date:** [October 7, 2020, 1:04pm UTC](https://community.traefik.io/t/404-when-using-pathprefix-with-docker-swarm/8091/1 "2020-10-07T13:04:50Z")

</div>

I'm running a docker swarm cluster with traefik on the manager node. I have an alias set up in `/etc/hosts` for the manager node as `homelab`. My swarm has an overlay network named `traefik_internal`.

I've got portainer set up in the swarm with these labels:

```auto
- "traefik.enable=true"
- "traefik.docker.network=traefik_internal"
- "traefik.http.routers.portainer.rule=PathPrefix(`/portainer`)"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
- "traefik.http.routers.portainer.entrypoints=http"
- "traefik.http.middlewares.portainer.stripprefix.prefixes=/portainer"
- "traefik.http.middlewares.portainer.stripprefix.forceSlash=false"

```

When I navigate to `http://homelab/portainer` I get the normal traefik 404 page not found string. I'm having the same problem trying to expose the traefik dashboard using these labels:

```auto
- "traefik.enable=true"
- "traefik.docker.network=traefik_internal"
- "traefik.http.routers.traefik.rule=PathPrefix(`/traefik`)"
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.middlewares.traefik.stripprefix.prefixes=/traefik"
- "traefik.http.middlewares.traefik.stripprefix.forceSlash=false"

```

When I run `docker network inspect` on the `traefik_internal` network I can see my container and its IP:

```auto
"5f80181c85c908ab118f06999e2d755c62b1aa586a3e49225308d17fc064eb4d": {
"Name": "portainer_portainer.1.sdyfy5ojyiiaalz5858e6gy71",
"EndpointID": "926f1c9230f3d0818c6c9374c3cbda146663edcf2d98f89185ae1d7d3c000f38",
"MacAddress": "02:42:0a:00:01:3a",
"IPv4Address": "10.0.1.62/24",
"IPv6Address": ""
},

```

And in the traefik logs when I go to that URL I can see it's trying to forward to the correct IP address:

```auto
Forwarding this request to URL" ForwardURL="[http://10.0.1.62:9000](http://10.0.1.62:9000/)"

```

But in chrome I just see 404 page not found. Am I missing some configuration or doing anything incorrectly?

---

<div class="post-metadata">

**Author:** ![davidsbond](https://avatars.discourse-cdn.com/v4/letter/d/cc9497/32.png) [@davidsbond](https://community.traefik.io/u/davidsbond)\
**Post date:** [October 7, 2020, 1:59pm UTC](https://community.traefik.io/t/404-when-using-pathprefix-with-docker-swarm/8091/2 "2020-10-07T13:59:12Z")

</div>

Realised I wasn't actually adding the middleware to the router. It works fine when I do that!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [October 10, 2020, 1:59pm UTC](https://community.traefik.io/t/404-when-using-pathprefix-with-docker-swarm/8091/3 "2020-10-10T13:59:13Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
