Skip to content

Enabling CORS for a HTTPRoute  #567

@Amila-Rukshan

Description

@Amila-Rukshan

Description:

I see two ways to enable CORS in for a HTTPRoute either via a targetRef from a Policy resource or an extensionRef from a custom route filter.

Will envoy-gateway support another CR like below for this purpose?

apiVersion: gateway.envoy.io/v1alpha1
kind: CORSPolicy
metadata:
 name: cors-policy-1
Spec:
  default:
    corsConfigurationEnabled: true
    accessControlAllowOrigins:
     - '*'
    accessControlAllowCredentials: true
    accessControlAllowHeaders:
     - authorization
     - Access-Control-Allow-Origin
     - Content-Type
     - accept
     - origin
    accessControlAllowMethods:
     - GET
     - PUT
     - POST
     - DELETE
     - PATCH
     - OPTIONS
  targetRef:
    kind: HTTPRoute / Gateway
    name: http-route-1 / my-gateway

with this setting, it should be able to configure cors filter in HTTPRoute or Gateway levels.

Any thoughts?

Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions