How to enable CORS plugin on K8S and dbless kong

I have to enable CORS plugin on K8S and dbless kong.
Any example available?

Thanks in advance

@arvtiwar Please do not cross-post. It leaves threads hanging in the forum and the maintainers have a hard time navigating all the notifications. If you post once, please have patience and someone will get back to you as soon as they can.

Regarding this:

What problem did you run into? That looks correct on the face of it.
The general guidelines is that you should take the config part of the plugin configuration from the docs site and then change it to YAM format under the config property of KongPlugin resource.

Sorry for cross-post.
This is how I set up the plugin and ingress

My problem is, it is not at all setting up the CORS headers as defined in config.

Can you login into the Kong container and check if the plugin has the right configuration ?
You can use Kong’s Admin API to check that.

FYI, this Kong community edition. I guess kong-admin is not for community edition?
More info
This K8S 1.16.2 instance on DigitalOcen
I have two service {myapp-web, myapp-api} running which kong is proxing.

Observation 1
If remove ( myapp-kong-ingress) below which enforces HTTPS and access “” on HTTP all CORS headers are set and all works fine

Observation 2
When I enable ( myapp-kong-ingress) and access “” on HTTPS, CORS plugin is not working as no header on API response

Observation 3
Directly hitting the API after enabling “http-add-header”, no header is there as we are setting up “Access-Control-Allow-Origin:” on the plugin

Any idea?

Also when you say “login into the Kong container” you mean using the shell? are we running shell in “kong-proxy” container? More context please


shell into the kong-proxy container and look up the Admin API.

Thanks Harry for all the suggestions. let me try

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ