I use a basicauth middleware for access to the traefik api.
If I use it alone, it works fine.
but if I use it with errors middleware that redirects 401 errors, the basicauth do not show any login prompt and just throw a 401 error from the errors middleware
the router:
"routers":{
"api@file":{
"entryPoints":["websecure"],
"middlewares":["errorpage@file","ipwhitelist@file","minikea@file"],
"service":"api@internal",
"rule":"Host(`traefik.minikea.org`)",
"tls":{"certResolver":"OVH"},
"status":"enabled",
"using":["websecure"]}}
the middlewares:
"middlewares":{
"minikea@file":{
"basicAuth":{"users":["minikea:$apr1$CS/5oASo$xG7nYzCWksMj.1TD0sfet1"]},
"status":"enabled",
"usedBy":["api@file"]},
"errorpage@file":{
"errors":{"status":["401-404"],"service":"fallback","query":"/{status}.jpg"},
"status":"enabled",
"usedBy":["api@file"]},
"ipwhitelist@file":{
"ipWhiteList":{"sourceRange":["127.0.0.1/32","192.168.1.0/24","172.19.0.1"]},
"status":"enabled",
"usedBy":["api@file"]}
logs:
traefik | time="2020-01-22T13:08:09Z" level=debug msg="Handling connection from xx.xx.xx.xx:30532"
traefik | time="2020-01-22T13:08:10Z" level=debug msg="Authentication failed" middlewareName=minikea@file middlewareType=BasicAuth
traefik | time="2020-01-22T13:08:10Z" level=error msg="Caught HTTP Status Code 401, returning error page" middlewareName=errorpage@file middlewareType=customError
if I remove the errors middleware, I have this kind of logs:
incorrect login:
traefik | time="2020-01-22T13:12:28Z" level=debug msg="Authentication failed" middlewareName=minikea@file middlewareType=BasicAuth
traefik | time="2020-01-22T13:12:33Z" level=debug msg="Authentication failed" middlewareName=minikea@file middlewareType=BasicAuth
correct login :
traefik | time="2020-01-22T13:12:44Z" level=debug msg="Authentication failed" middlewareName=minikea@file middlewareType=BasicAuth
traefik | time="2020-01-22T13:12:49Z" level=debug msg="Authentication succeeded" middlewareName=minikea@file middlewareType=BasicAuth
the first 401 response should not be transfered to the second middleware or there should not be a first 401 response in the first place.
If I pass the username:password in the url, the behavior is exactly the same.