Gateway跨域, 出现allowed origin重复问题: The ‘Access-Control-Allow-Origin’ header contains multiple values
现象: 跨域时出现这个情况, Spring Cloud Gateway 2.1.3
浏览器console:
Access to XMLHttpRequest at ‘http://localhost:88/api/sys/login’ from origin ‘http://localhost:8001’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘http://localhost:8001, http://localhost:8001’, but only one is allowed.
背景:
但是我只设置了一次, 并且没有像网上经常出现的也在nginx又设置了一次的情况. 因为根本没有使用nginx.
以下是我在gateway中的, 用于解决跨域问题的过滤器:
package org.zhangcl.gulimall.gateway.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org