Disable basicauth for local clients

Is it possible to disable basicauth only for clients in local network but keep it for all others?

You can duplicate routers and have one with rule Host() && ClientIP() without auth.

Thank you. Something like this?

      - traefik.http.routers.mydashboard.rule=Host(`${DOMAIN}`) && ClientIP(`192.168.1.0/24`)
      - traefik.http.routers.mydashboard.service=api@internal

      - traefik.http.routers.mydashboardwithauth.rule=Host(`${DOMAIN}`)
      - traefik.http.routers.mydashboardwithauth.service=api@internal
      - traefik.http.routers.mydashboardwithauth.middlewares=myauth
      - traefik.http.middlewares.myauth.basicauth.users=admin:......

Looks like this works, but should I add anything here?

1 Like

Looks good to me.

Feel free to check the blog post I wrote a while ago about it Using Basic Auth in Traefik conditionally | bitExpert