Using Nginx maintained Inc Ingress as reverse Proxy on GKE .
To implement Cors policy, we are trying out VS.
However , when we add responseHeaders to VS , or to a policy separately, I see errors .
Error from server (BadRequest): error when creating “cors-policy.yaml”: Policy in version “v1” cannot be handled as a Policy: strict decoding error: unknown field “spec.responseHeaders”
Policy :
apiVersion: k8s.nginx.org/v1
kind: Policy
metadata:
name: cors-response-headers
namespace: default
spec:
ingressClassName: nginx
responseHeaders:
add:
- name: Access-Control-Allow-Credentials
value: “true”
- name: Access-Control-Allow-Headers
value: “X-Forwarded-For, Content-Type, Authorization”
- name: Access-Control-Allow-Methods
value: “PUT, GET, POST, OPTIONS”
- name: Access-Control-Allow-Origin
value: “*”
- name: Access-Control-Max-Age
value: “86400” # 24 hours in seconds
Where should the action Proxy be specified in VS ? VirtualServer and VirtualServerRoute resources | NGINX Ingress Controller