-
-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HEAD to forward-auth protected URL returns HTTP 500 #156
Comments
Hey, I've just tested this and it works correctly when querying tfa directly, but something seems to be going wrong when traefik makes the forward auth request:
Looking at the code on traefik, it looks like they are throwing that error after attempting to read the body here: https://github.com/containous/traefik/blob/de458b735762ab12a66e92807ddc47345cdb44d0/pkg/middlewares/auth/forward.go#L104-L113 However from From RFC 2616:
So to me this looks like a bug in traefik? |
I have the same problem 'cause: context deadline exceeded' with a docker registry 2.7 connected. No image can be pushed via docker.
no authentication rules are defined:
|
I'm hitting the same issue. I think in this case it's not really Traefik's fault, as Traefik always issues traefik-forward-auth/internal/server.go Line 59 in 4ffb659
This confuses I tried simply commenting that line out, and it indeed resolved the issue for me. However, that'll have an impact on the rules functionality of this service, in that it won't be able to match against method anymore. I don't know of an elegant solution at the moment ... |
I'm having the same issue here it seems,
So I do feel I'm stuck as I've put this forwardauth middleware by default on the entrypoint which I very much need as it applies to some 50 or so container that don't have to explicitely enable this middleware. I see in @jasonxh post that commenting out the line would resolve the issue but prevent me to use methos in my rules, which I don't use so I could go with that workaround... Any chance we could get that fixed @thomseddon or maybe push another tag latest-nomethod ? Or maybe @jasonxh has already pushed a version with that commented out ? Thanks in advance for any help, I'm going to bed now but I'll give it another try tomorrow and mayby get to build my own dowker image of this repo with the line commented out. |
I've only built an image for |
Thanks @jasonxh but I run it on x86_64. Will build it myself. Trying out something else with traefik first (a third entry point on a different port to bypass the middleware) |
I finally got around to do this, and indeed I got this working by
I'm going to stick with this workaround ad per @jasonxh it should only impact rules on the method, which is something I don't use, I stick to domain or path rules ;) But I'll be monitoring here if someone finds a "more elegant solution" and I can go back to using the official image for this wonderful forward-auth plugin ! Note that I'm also counting on this issue at traefik hopefully moving forward, that would allow me to simply disable the forward-auth middleware just for the docker repository router, but I need to keep it on for all the rest (right now my allow rule makes this middleware transparent as long as it doesn't do strange things to the method...) |
If anyone still needs it, I've built an x86_64 image with the workaround. It's available at mdinicola/traefik-forward-auth:latest |
Hi, Homer has an HTTP request to check connectivity with the server using HEAD request using the fetch API. When I disable the forward-auth middleware the connectivity check works and I get 200 OK. So, it's seems that the plugin does not work with HEAD requests. Beside using the workaround is there a way to make the plugin ignore the connectivity check based on some rule that check for specific QS parameter? |
I didn't try because I was not wanting to disable auth even for Head request only but if that's acceptable to you there is a documentation here that explains the rules you can put in forward.ini and you would probably be able to always authorize requests based on the query string. |
Traefik sends a forward auth request for every request, including HEAD methods, in order to validate if a request can continue. Due to Go HTTP client being strict to the HTTP SPEC, the response of a HEAD does not include a body, while Traefik expects a validation response to be embedded, causing errors. To mitigate this, when a X-Forwarded-Method is set as HEAD, we'll avoid modifying the HTTP Method response in order to send a body back, allowing head requests to by validated. This is necessary even if an allow rule is set, otherwhise it will fail as well. Mitagates: thomseddon#156
We have some URLs behind traefik-forward-auth and during some tests we found out that a HEAD (
curl -I
) to those URLs fails with aHTTP 500
return code after 30s.A GET to the same URL immediately returns the correct redirection with status code
HTTP 307
.I have no idea what is supposed to happen upon a HEAD to those URLs, but if HEAD is not supported I would have expected a
HTTP 405 method not allowed
as the answer.The text was updated successfully, but these errors were encountered: