Casing inconsistencies in basicAuth middleware

Hi,

After a frustrating afternoon of figuring out how to get basicAuth to work, here's one thing I've noticed.

In "file" provider, when defining BasicAuth using this definition the middleware fails to load

[http.middlewares]
  [http.middlewares.test-auth.basicauth]
  users = [ "test:$apr1$lh09upfq$nZfVoqrKwOHV407gf4tLI0" ]

Middleware only works when [http.middlewares.test-auth.basicAuth] is defined with a capital 'A'

Yet when defining this middleware in marathon provider
"traefik.http.middlewares.myauth.basicauth.users": "test:$apr1$lh09upfq$nZfVoqrKwOHV407gf4tLI0"
works with lower-case 'a' in basicauth. Indeed this also works with basicAuth

No errors logs are given to pin point the problem other than that the middleware doesn't exist when you start using the middleware in a router. I only figured out the problem by copying and pasting code example from documentation. (and am I glad that the docs are actually correct!)

Given that the middleware type itself is called BasicAuth the case inconsistencies across different providers is confusing. It seems that also this isn't the first time that folks using v2.0 have been tripped up by casing, see - Issue triage - Documentation is wrong for ForwardedHeaders (CLI casing)

Are there going to be plans to address casing inconsistencies in config specification across providers in upcoming releases?

p.s. - this is using v2.0.2

Hello,

TOML and YAML are case sensitive because it's in the spec of the languages.

The labels (for Marathon, Docker, ..) are case insensitive.

1 Like

Yes, I get the rationale of why casing is the way it is right now. However, there are no warnings in the documentation in the file provider.

I think you're going to now comment and say "Case-sensitivity behavior didn't change from v.1.7"

I've never used the file provider in v1.7 - so I didn't know this. With version 2.0, I now have to use file provider now b/c I would like to re-use some of the middlewares without having to add tons of new labels into my marathon apps. (for example, compress, retry) Given that in v2.0 global level settings are gone, I now need to resort to file providers without having to redefine the same settings over and over again on each app.

From your answers, i'm guessing that you think having these case-sensitivity differences without a warning in the documentation is good usability. I hope you will change your mind because I'm willing to bet this is a source of confusion for many who are upgrading.