oathkeeper icon indicating copy to clipboard operation
oathkeeper copied to clipboard

Can CORS settings be configured/extended per rule?

Open dan2kx opened this issue 3 years ago • 1 comments

Preflight checklist

Describe your problem

I would like to configure cors settings on a rule by rule basis

Describe your ideal solution

I'm using oathkeeper-maestor in a kubernetes environment to create my rules and it would be useful to be able to adjust the cors settings such as allowed origins or exposed headers per rule rather than for the whole service.

Workarounds or alternatives

I'm not sure if this is currently possible, i couldn't find anything in the docs

Version

v0.38.15

Additional Context

No response

dan2kx avatar Feb 17 '22 22:02 dan2kx

I would expect to have your CORS rules in your north south microservice gateway (emissary, ambassador, traefik, contour, kong) mapping not in your authservice. But then you have to authorize the OPTIONS call without authentication to your services in a mapping. Example with gRPC or gRPC-web service with auth service with crd mappings.getambassador.io

bypass_auth: false
  connect_timeout_ms: 5000
  cors:
    credentials: false
    exposed_headers:
    - x-user-agent
    - grpc-status
    - grpc-message
    - content-type
    - x-grpc-web
    headers:
    - Content-Type
    - authorization
    - x-user-agent
    - x-grpc-web
    max_age: "86400"
    methods:
    - DELETE
    - GET
    - OPTIONS
    - POST
    - PUT
    origins:
    - YOUR HOST
  grpc: true

a-manraj-pvotal avatar Jul 13 '22 08:07 a-manraj-pvotal

I agree, this is out of scope for Ory Oathkeeper - sorry :/

aeneasr avatar Nov 16 '22 12:11 aeneasr