ingress-gce icon indicating copy to clipboard operation
ingress-gce copied to clipboard

How to enable Access-Control-Allow-Origin from gce-ingress

Open ankit-rsystem opened this issue 3 years ago • 8 comments

We are facing an error related of CORS policy:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Is there any way to allow it from gce-ingress annotations ?

Please help.

ankit-rsystem avatar Dec 29 '21 09:12 ankit-rsystem

Can you elaborate where did you get this error? When sending traffic to the ingress VIP?

freehan avatar Jan 11 '22 17:01 freehan

/triage needs-information

kundan2707 avatar Feb 16 '22 18:02 kundan2707

NGINX ingress allows you to do this...

annotations: 
  nginx.ingress.kubernetes.io/enable-cors: "true"
  nginx.ingress.kubernetes.io/cors-allow-origin: "www.example.com"

Is there an equivalent for the gce-ingress? I can't find any security features on it, the ingress is accessible to anyone externally.

synvestable avatar May 03 '22 18:05 synvestable

/kind feature

swetharepakula avatar May 20 '22 21:05 swetharepakula

+1

allenvino1 avatar Jun 16 '22 01:06 allenvino1

+1 :)

tdi avatar Sep 13 '22 12:09 tdi

+1

naxo8628 avatar Sep 19 '22 15:09 naxo8628

Work to allow users to specify custom response headers using the BackendConfig is in progress. I will update this ticket again once it it is available in GKE.

swetharepakula avatar Sep 19 '22 19:09 swetharepakula

+1

jstncno avatar Nov 04 '22 21:11 jstncno

Custom response headers can now be configured through the BackendConfig CRD. This feature is available for new GKE 1.25+ clusters.

dup #1106

swetharepakula avatar Dec 27 '22 19:12 swetharepakula

I see that 1106 has been closed out, but it's unclear how this can be achieved as I'm not really seeing any documentation or examples for this new feature. Can anyone provide me an example so I don't have to check the box in the IAP console?

(apologies for the repost, I deleted for a period where I convinced myself that my issues something else)

ohshazbot avatar Mar 13 '23 16:03 ohshazbot

Custom response headers can now be configured through the BackendConfig CRD. This feature is available for new GKE 1.25+ clusters.

dup #1106

Hi @swetharepakula, it appears this isn't documented yet here ? Is this definitely GA ? There's only a mention of request (not response) headers. Thanks.

renaudguerin avatar Jun 26 '23 17:06 renaudguerin

That is correct the field is not yet documented, but the field should be available for 1.25+ clusters.

We will work to update GKE public docs

swetharepakula avatar Jul 05 '23 19:07 swetharepakula