-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
CORS Headers missing when using auth-url and auth-signin with Oauth2-Proxy #8786
Comments
/remove-kind bug
/close |
@longwuyuan: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I can confirm the reported behavior. The information provided below should reproduce the issue. We've seen it on multiple versions of the ingress controller, currently with 1.2.0. Our nginx ingress controller has the following configuration, with URL's updated for privacy reasons:
With the above configuration, we're making a request to our service with a curl command like:
Which produces a response like:
Note that CORS headers are missing from this response, which causes browsers to block it. If we remove
CORS headers are present and the response does not get blocked by the browser. NGINX Ingress controller version: 1.2.0 Kubernetes version:
Browsers used:
|
/reopen |
@schmidtk: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Sorry, robot. Worth a shot. |
/reopen |
@longwuyuan: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@schmidtk I recall a PR where we narrowed the scope of what a valid origin ought to be. If you can search and find, it will be great but I hope I will I will search for that PR and check if its related to you using a random |
Thank you, I can look around and see if there are other issues that might be related. I don't think the |
Oh, that is important insight. Now need to get some dev time on it. Its hard as we are on freeze for features but this seems like a bug. Will update. /area stabilization |
/priority important-longterm |
Hi @longwuyuan
Inside this block even the CORS header set in parent request are not retained. Should we also add template which generate code to add headers related to CORS also inside the above block generation in |
@harry1064 , I don't know yet. You have the option to ;
|
/assign |
@harry1064 , before you conclude that a new template is enough, kindly help out and test for security by using random origin. There was a PR merged to not allow random origins. In fact it checked for more. Can't recall the PR number now but regardless, it will be important to figure out if generating headers allows for random origin or not. |
@longwuyuan Yes sure. I will try find the PR and check it. |
@longwuyuan Is this the PR you were talking about? |
Yes. And if I recall correctly there is one more by another author. Point
being some work was done to secure CORS so need to check if that is causing
missing headers. Normally, all headers are expected to pass through and be
visible on packet inspection.
Thanks,
; Long
…On Tue, 12 Jul, 2022, 8:45 AM Harpreet singh, ***@***.***> wrote:
@longwuyuan <https://github.com/longwuyuan> Is this the PR you were
talking about?
—
Reply to this email directly, view it on GitHub
<#8786 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGZVWQD5QD4UF5XVMG7T2LVTTPNVANCNFSM52XRFYOA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi @longwuyuan
I have checked the implementation. It is not causing any issue. It is working as it should be.
So it is clear that, when error 401 case happens, and user taken to internal location block, headers are not retained. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
We experiencing the same issue with image apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/auth-response-headers: x-auth-request-user, x-auth-request-email,
x-auth-request-access-token
nginx.ingress.kubernetes.io/auth-signin: https://oauth2.example.com.com/oauth2/start?rd=$scheme://$best_http_host$request_uri
nginx.ingress.kubernetes.io/auth-url: https://oauth2.example.com/oauth2/auth
nginx.ingress.kubernetes.io/cors-allow-origin: http://localhost:9898, https://podinfo.example.com
nginx.ingress.kubernetes.io/cors-expose-headers: '*'
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: 16k
nginx.ingress.kubernetes.io/service-upstream: "true"
--- snip --- |
/remove-lifecycle stale |
/help |
@longwuyuan: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@johanneswuerbach Your PR just fixed the missing CORS headers for failed auth requests, right? So this issue still persists and should be open |
Yes, I didn't check whether this is also enough to pass the tests in :( #8814 |
Will take care of it later! |
What happened:
I have added the following annotations in my Ingress definition
with the host configured as api.xyz.com and the OIDC issuers being keycloak
On doing a curl to https://api.xyz.com/api/v1/onboard/getAssociatedOrganization here is the response I have gotten from NGINX which does not include any kind of CORS-specific headers
This is causing issues in the browser since on getting the 302 from NGINX due to the auth-signin annotation I start getting CORS errors
I have tried the following annotation to enable CORS headers in the 302 response but to no avail
What you expected to happen:
NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):
Kubernetes version (use
kubectl version
):The text was updated successfully, but these errors were encountered: