title: MicroService Architecture : CORS Configuration results in Access Control Allow Origin header contains multiple values
body: <p>I am developing a spring boot application. In which it has API-Gateway and three microservices. When I call API from UI it throws an error of CORS.</p>
  <p>Error:</p>
  <p>Access Control Allow Origin header contains multiple values but only one is allowed</p>
  <p><a href="https://i.stack.imgur.com/B1nYn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B1nYn.png" alt="enter image description here" /></a></p>
  <p>I already configured cors in application.yml in API-Gateway.</p>
  <pre><code>spring:
      application:
          name: api-gateway
      cache:
          type: redis
      redis:
          host: 'http://localhost'
          port: 6379
      cloud:
          gateway:
              globalcors:
                  corsConfigurations:
                  '[/**]':
                  allowedOrigins: &quot;*&quot;
                  allowedMethods: &quot;*&quot;
                  allowedHeaders: &quot;*&quot;
      eureka:
          client:
              eureka-server-d-n-s-name: my.dns
              eureka-service-url-Context: eureka
              fetch-registry: false
              region: ap-south-1b
              register-with-eureka: false
              use-dns-for-fetching-service-urls: true
          datacenter: cloud
      ribbon:
          eureka:
              enabled: false
      server:
          port: 8765
      zuul:
          routes:
              order-service:
                  url: 'http://localhost:8088'
              product-service:
                  url: 'http://localhost:8084'
              user-service:
                  url: 'http://localhost:8082'
  </code></pre>
  <p>Along with that, I have configured CORS in each microservices. Instead of calling API via API-Gateway if I call directly to microservice, it is working fine.</p>