How to disable CORS in API Gateway Spring Boot

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.