-
Notifications
You must be signed in to change notification settings - Fork 1.2k
--skip-auth-preflight not working #471
Comments
|
@idntfy I have tried both and none of them work :( |
are you sure it's not your backend who returns 302? the change doesn't do anything besides of checking that the method is OPTIONS. |
@idntfy Yeah I'm pretty sure. Here is the response headers: content-length:161 |
After 4 hours of research, I didn't solve this problem :( I hope someone will have an idea :) |
@idntfy after 1 day of research trying to debug by recompiling this lib, changing Ingress settings... just found the solution! My Angular app was doing AJAX calls and OPTIONS requests don't include cookies so my Ingress was redirecting to the login page (so 302 code but OPTIONS is waiting 200-299 HTTP code). The idea is to send good HTTP code with CORS headers. There is an "enable-cors" Ingress annotation but the Access-Control-Allow-Origin equals '*' so the browser don't allow to send GET/POST/DELETE/PUT with cookies (we need to give just 1 specific domain). I had to make my own customization in the right annotation:
And it works well! (For information, in Angular HTTP, to attach cookies on any request (except OPTIONS) you need to set the parameter withCredentials to true :) ) I hope it's gonna help someone, it may seem simple but with all these things to take in account it was really tricky 😢 Have a good day 😀 ! |
@jehiah it should have been easier if oauth2_proxy accepted to manage token through cookies and a custom header. For now there is just the cookie "_oauth2_proxy" but we could imagine to manage an header "X-OAuth2-Proxy" header if cookie is not present. Like that in any framework I just have to add this header on each HTTP request without dealing with "withCredentials + only 1 origin domain + enable CORS" 😃 EDIT: To get this token, I just have to read cookies in JavaScript |
Hi,
I'm doing some AJAX calls in my web app but unfortunately the OPTIONS request that check if the request is authorized (CORS...) receive an 302 redirect HTTP error because of oauth2-proxy.
Here is the error message:
So I have tried the oauth2-proxy option "--skip-auth-preflight" but it doesn't work for me :( is there any other thing to do to make it work?
Thank you!
CC: @ploxiln @idntfy #370
EDIT: To clarify, I'm using Kubernetes and its annotation
Maybe this option to skip auth on OPTIONS requests has not been tested with Kubernetes for now?
The text was updated successfully, but these errors were encountered: