Kubernetes – CORS enable

To enable CORS in ingress, add the following:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ...
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, OPTIONS"
    nginx.ingress.kubernetes.io/cors-allow-origin: "*"
    nginx.ingress.kubernetes.io/cors-allow-credentials: "true"

 

*allows requests from anywhere, replace it with the domain you need

Tagged: Tags

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments