When allowCredentials is true, AllowedOrigins cannot contain the special value “* “Since that cannot be set on the” access-Control-allow-origin” response header. To allow credentials to a set of origins, “List them explicitly or consider using”allowedOriginPatterns” instead.
When allowCredentials are true, allowedOrigins cannot contain the special value “*” because it cannot be set on the “access-Control-Allow-Origin” response header. To allow credentials as a set of sources, list them explicitly or consider using “allowedOriginPatterns” instead.
Put cross-domain Settings in the Gateway module:
Solution: Cross-domain configuration error, replace.allowedOrigins with.allowedOriginPatterns.
/** * Configure cross-domain *@return* /
@Bean
public CorsWebFilter corsFilter(a) {
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(Boolean.TRUE);
config.addAllowedMethod("*");
config.addAllowedOriginPattern("*");
config.addAllowedHeader("*");
config.setMaxAge(3600L);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser());
source.registerCorsConfiguration("/ * *", config);
return new CorsWebFilter(source);
}
Copy the code