update ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java.

org.springframework.web.cors.CorsConfiguration#setAllowedOriginPatterns

在对比allowedOrigins仅支持“*”和不能与使用allowCredentials

其次主要认为跨域这个问题应该交由反向代理或者放置SpringBoot Static 目录中, 通过Static Server 方式, 或者 Nginx  反向代理
至于开发环境应该交由 webpack Proxy 解决
This commit is contained in:
xiaoshitou 2021-09-19 16:39:06 +00:00 committed by Gitee
parent a292cccb63
commit e36632e6bb

View File

@ -51,7 +51,6 @@ public class ResourcesConfig implements WebMvcConfigurer
{
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
// 设置访问源地址
config.addAllowedOrigin("*");
// 设置访问源请求头