kong icon indicating copy to clipboard operation
kong copied to clipboard

Kong Cors Plugin - unable to add multiple url in the origins config

Open carmine-ianniello-deltatre opened this issue 1 year ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Kong version ($ kong version)

KIC 3.1

Current Behavior

Hello,

I'm using Kong ingress controller 3.1 version with the Cors plugin configured as below. When I use it with a single origin in the config field, everything works as expected, as shown in the image below.

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: kong-cors-custom
config:
  origins:
  - first-url.com
  - second-url.com
  credentials: true
  max_age: 3600
  preflight_continue: false
plugin: cors

image

But when I try to add another origin, the Allow-Control-Allow-Origins header disappears, not allowing neither the first URL.

From my understanding the plugin should be able to add multiple origins URLs, is that right?

image

Expected Behavior

I'm expecting to be able to allow multiple URL with cors plugin

Steps To Reproduce

  • Create the cors plugin in yaml format
  • add 2 or more hostname in the origins config
  • check the header in the Response headers

Anything else?

No response

Recommend to use Kong version 3.8.

And check if it's an existing issue: https://docs.konghq.com/hub/kong-inc/cors/changelog/

CC: @randmonkey

xianghai2 avatar Nov 26 '24 06:11 xianghai2

I have istalled kong KIC via helm chart and the latest version seems 2.42.0 with 3.7.0 version

Hi @tao12345666333 , I'm not familiar with KIC. Do you know how to upgrade Kong in KIC to version 3.8, or when it will be upgraded to 3.8?

Water-Melon avatar Dec 06 '24 10:12 Water-Melon

@carmine-ianniello-deltatre you can try simply giving "*" for origin, if security is not an issue here

KDTEC avatar Dec 26 '24 18:12 KDTEC

@Water-Melon You can just update the values.yaml and set gateway.image.tags to "3.8" when you install KIC by kong/ingress charts.

randmonkey avatar Mar 04 '25 02:03 randmonkey

Hi @tao12345666333 , I'm not familiar with KIC. Do you know how to upgrade Kong in KIC to version 3.8, or when it will be upgraded to 3.8?

Please follow the upgrade documentation:

https://docs.konghq.com/kubernetes-ingress-controller/latest/upgrade/gateway/

Kong gateway 3.8 can be used with KIC.

tao12345666333 avatar Mar 18 '25 02:03 tao12345666333