Hi:
I tried to use Spring Web Gateway Configuration and the follow problem occur using Spring Webflux:
-----------------------
"from origin 'null' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed", spring cloud gateway
----------------------
The solution was to use predicates of Spring Webflux instead:
-------------------
server:
port: 7002
eureka:
instance:
hostname: localhost
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8761/eureka/
spring:
application:
name: server-gateway
cloud:
gateway:
server:
webflux:
routes:
- id : service-envio
uri: lb://abc
predicates:
- Path=/senvios/**
filters:
- RewritePath=/senvios/*, /
default-filters:
- DedupeResponseHeader=Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_UNIQUE
globalcors:
cors-configurations:
'[/**]':
allowedorigins: "*"
allowedmethods: "*"
allowedheaders: "*"
allowed-credentials: true
-------------------
Best Regards,