Make ambassador edge stack intercept CORS preflight requests

5/4/2020

Been struggling to make ambassador edge stack deployment to intercept pre flight requests on our kubernetes cluster.

What we want to achieve is OPTIONS request -> Ambassador -> Reply to this OPTIONS request, but ambassador is always routing the request to the backend service.

Per the docs we configured the following YAML:

apiVersion: getambassador.io/v2
kind: Module
metadata:
  name: ambassador-global-config
  namespace: {{ $config.namespace }}
spec:
  config:
    buffer:
      max_request_bytes: 22020096 #21MiB
    cors:
      origin_regex: 'some origin regex'
      methods:
        - GET
        - PUT
        - POST
        - DELETE
        - HEAD
        - OPTIONS
      headers:
        - Origin
        - Content-Type
        - Accept
        - Authorization
      credentials: true
      max_age: 86400

Ambassador detects this configuration (from the logs) but does nothing with it, what are we missing here?

-- Ricardo Gomes
ambassador
api
cors
gateway
kubernetes

0 Answers