kusk-gateway icon indicating copy to clipboard operation
kusk-gateway copied to clipboard

Make it easier to configure CORS

Open olensmar opened this issue 3 years ago • 2 comments

As an API developer all I want to is "enable CORS" and not have to get bogged down by all configuration settings - perhaps Kusk could provide a "CORS templates" (configurable?) - which I could refer to - i.e.

x-kusk:
  cors: 
     template: default

which would expand to whatever we think is a reasonable default setting for CORS. The possibility to configure other templates would be at the kusk-gateway level - perhaps via a CRD!?

olensmar avatar Apr 29 '22 09:04 olensmar

Maybe we can even autogenerate CORS?

Current CORS configuration looks like this:

      cors:
        origins:
          - 'http://example.org'
          - 'http://example.com'
        methods:
          - POST
          - PATCH
          - DELETE
          - PUT
          - GET
          - OPTIONS
        headers:
          - Content-Type
        credentials: true
        max_age: 86200

We can get hosts, methods, headers from open api spec?

povilasv avatar May 04 '22 05:05 povilasv

duh - why didn't I think of that! We should definitely be able to auto-generate some of these (methods, hosts, headers) - perhaps this could be a template: auto setting!?

olensmar avatar May 04 '22 06:05 olensmar