Use another header than Authorization for basic auth

Hi there,

I have an api using basic auth behind Traefik and i would like to add an authentication at Traefik level.
I succeeded in configuring basic auth at Traefik level using the basic auth middleware, but i want the credentials for authenticating at Traefik level to be different than at app level (some kind of MFA) and i only have one possible Authorization header to hold them both.
The solution i was hoping from Traefik basic auth middleware is to be able to define a specific header to be used for authentication, but looking at the doc and the source code, it seems it's not possible at the moment.
I guess https://github.com/traefik/traefik/blob/master/pkg/middlewares/auth/basic_auth.go#L65 would have to be updated to get the authorization from a specific header.

Do you have any suggestion how i could achieve this?

Thanks,
MX

1 Like