# 404 page not found when using with PathPrefix

**URL:** <https://community.traefik.io/t/404-page-not-found-when-using-with-pathprefix/22347>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [April 18, 2024, 2:05pm UTC](https://community.traefik.io/t/404-page-not-found-when-using-with-pathprefix/22347 "2024-04-18T14:05:07Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [April 19, 2024, 9:37am UTC](https://community.traefik.io/t/404-page-not-found-when-using-with-pathprefix/22347/8 "2024-04-19T09:37:59Z")

</div>

For the newbies among us:

When you request a URL from Traefik, like `example.com/app`, you can route by domain and (optional) path. When Traefik is forwarding to the target service, the path will be re-used (`GET /app`). So your target service needs to respond to this specific path.

You can use `stripprefix` middleware, to remove the path from the forwarding request. This works great with API apps, that only use a single request.

Usually modern web apps will need a lot of dependencies, like `/static/script.js` and `/img/logo.jpg`. Those are linked with absolute path from the initial page you load. So even if you get external path `/app` to load the first page, the browser will then try to load `/static/script.js`, to which Traefik can not route with path `/app`.

So if path based routing should work with a web app, you need to tell it to respond to the desired path, with the initial start page and also with all required dependencies.

Best practice is to use sub-domains, so you don't need to mess with path settings inside the web app - and sometimes its not even possible.

Two examples:

- Traefik dashboard is fixed to `/dashboard`, this can't never be changed.
- Wordpress can be configured to use a `/app` by setting a "base path".

---

_[View the full topic](https://community.traefik.io/t/404-page-not-found-when-using-with-pathprefix/22347)._
