oauth2_proxy icon indicating copy to clipboard operation
oauth2_proxy copied to clipboard

will oauth2_proxy support PUT

Open mchiao opened this issue 7 years ago • 2 comments

I got oath2_proxy working with openresty/nginx.

However, I have noticed an issue or not...
Lets say I made a PUT request to my nginx, request hands to oauth2_proxy for authentication/authorization. When oauth2_proxy finishes (validating access token, refresh token, etc...), it redirect back to nginx but now with a 'GET' instead of 'PUT'.

Is this normal? a feature?

Thanks

mchiao avatar Sep 05 '18 19:09 mchiao

The first request from browser which is not already "logged-in" to oauth2_proxy will go through the oauth2 flow and end up with a redirect back to the original destination, with method changed to GET (and no body, of course).

Subsequent requests will carry the cookie which oauth2_proxy will recognize, and the PUT will go through to the backend service unchanged.

If you're using the nginx auth_request directive, it's a bit more complicated: the auth request to oauth2_proxy will not include the body, but will have the original Content-Length header, which will confuse oauth2_proxy into waiting for a body which will not come. The README has the nginx config options to correct for this.

ploxiln avatar Sep 05 '18 19:09 ploxiln

Yes, auth_request is being used...

Are you referring to these lines?

proxy_set_header Content-Length   "";
proxy_pass_request_body           off;

Regards,

mchiao avatar Sep 05 '18 20:09 mchiao