Different CORS for different paths

I try to configure Ingerss type: kong to use different cors for different paths
In the example below, CORS is global for all paths. I need to allow GET for /some/path, and POST for /some/otherPath

paths:
  - path: /some/path
        backend:
          serviceName: service1
          servicePort: 8080
  - path: /some/otherPath
        backend:
          serviceName: service2
          servicePort: 8080
plugins:
  - name: cors
    config:
       origins: https://something.com
       methods:
          - POST
          - GET

I’d suggest investigating whether you need per-path CORS vs allowing e.g. GET & POST on all routes. I haven’t seen any sites in my Kong that need this. In fact I have a CORS ClusterPlugin which makes it easy to use a standard setup.

If you do want to have different plugin settings for different paths, i generally accomplish this by defining the paths in separate Ingress documents. In the different documents you’ll be able to select different plugin configs.

Hope this helps.

Edit to say… Ah crap, I read the date as July 21st. But now it says 12 Months Later. Oh well