adyanth / traefik-container-manager

Start docker containers on requests and stop them after a timeout
21 stars 1 forks source link

Bug with Auth #12

Closed JamesDAdams closed 3 years ago

JamesDAdams commented 3 years ago

Hi, again me 😁

I found a bug, i use Auth with a container and with traefik-container-manager the auth doesn't work, anyone can view the site.

adyanth commented 3 years ago

Hey James :) Can you tell me if the auth is by another middleware? If so, the order in which you chain it matters. The auth middleware should come first, and then this one.

If that does not work, if you have a minimal example I can try out, that would be good.

JamesDAdams commented 3 years ago

Ok, I put the auth middelware after the manager and it's work.

on the other hand, a feature that would be great is that the manager only turns on the container if the auth is validated. Because there are lots of bots on the internet that spam domain names so the containers will always be on.

adyanth commented 3 years ago

Wait, it works when you have auth after the manager? In that case, looks like the auth middleware is skipping further middlewares in the chain and directly tries to serve the content which fails.

How are you adding auth? Is it Traefik's Basic/Digest/Forward auth or are you using a custom middleware? Could you show an example?

From this middleware's perspective, all it does it call the next function, which directs Traefik to use the next middlewares if any, and then reach the service. Looks like the auth is not passing control to the next middleware. https://github.com/adyanth/traefik-container-manager/blob/e7ae8d34260f9c518cdd65b68b81c0233b38894b/manager.go#L113

adyanth commented 3 years ago

Closing it as this seems to be a bug on the auth middleware, not this.