How to disable CORS in API Gateway Spring Boot

Abhinav JhaAbhinav Jha
1 min read

Credit for this solution :- https://stackoverflow.com/a/78422113

Thank you!!

After struggling for more than 2 days, I found this thing which I have Used to resolve CORS error in my spring boot microservice to disable CORS,

I have my application.properties and application.yaml
inside my application.yaml, I pasted this code

spring: application: name: api-gateway cloud: gateway: globalcors: cors-configurations: '[/**]': allowedOrigins: - "*" allowedMethods: - "*" allowedHeaders: - "*" exposedHeaders: - "*" default-filters: - DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin

for ref here is the image link attached :-

Hope this will help you.

0
Subscribe to my newsletter

Read articles from Abhinav Jha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abhinav Jha
Abhinav Jha

Software Engineer