Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to add cors headers on btp kyma?

I am trying to allow cors requests for my microservice deployed on btp kyma. The microservice locally does add all the required cors headers but when deployed on to Kyma they are being overridden. I tried to add headers manually on the api rule as follows:

      mutators:
        - handler: header
          config:
            headers:
              cors-header: cors-header-value

But this is not working. Is there any other way to allow this?

Tried to use apirule configuration but it didn’t work

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can update the virtual service associated with this api rule with the cors headers as follows:

spec:
  http:
    - corsPolicy:
        allowCredentials: true
        allowHeaders:
          - Authorization
          - Content-Type
        allowMethods:
          - GET
          - POST
          - PUT
          - DELETE
          - PATCH
        allowOrigins:
          - regex: .*

Either create an apirule manually or update your apirule to use an existing virtual service.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading