# Exclude particular path(s) from basicauth

**URL:** <https://community.traefik.io/t/exclude-particular-path-s-from-basicauth/6643>\
**Category:** Traefik v2\
**Tags:** middleware\
**Created:** [June 24, 2020, 1:51pm UTC](https://community.traefik.io/t/exclude-particular-path-s-from-basicauth/6643 "2020-06-24T13:51:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![noeleon](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/noeleon/32/2226_2.png) [@noeleon](https://community.traefik.io/u/noeleon)\
**Post date:** [June 24, 2020, 1:51pm UTC](https://community.traefik.io/t/exclude-particular-path-s-from-basicauth/6643/1 "2020-06-24T13:51:23Z")

</div>

I am wondering if it's possible to remove basic authenticaiton for a particular PathPrefix. I would like to protect all but one or two particular paths.

my configuration (using docker) is something like this:

- traefik.http.routers.web-prod.rule=Host(`my.site`)
- traefik.http.routers.web-prod.middlewares=prod-auth
- traefik.http.middlewares.prod-auth.basicauth.users=user:pw

I can't seem to find a way to then exclude say PathPrefix(`/api`)

Is this even possible with traefik?

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [June 24, 2020, 2:39pm UTC](https://community.traefik.io/t/exclude-particular-path-s-from-basicauth/6643/2 "2020-06-24T14:39:13Z")

</div>

You would have to add another router on the service.

```yaml
- "traefik.http.routers.first.rule=Host(`my.site`)"
- "traefik.http.routers.first.middlewares=prod-auth"
- "traefik.http.middlewares.prod-auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/'"
- "traefik.http.routers.second.rule(Host(`my.site`) && PathPrefix(`/api`))"

```
