|
|
@@ -36,7 +36,7 @@ public class ResourcesConfig implements WebMvcConfigurer
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 自定义拦截规则
|
|
|
+ * 自定义拦截规�?
|
|
|
*/
|
|
|
@Override
|
|
|
public void addInterceptors(InterceptorRegistry registry)
|
|
|
@@ -53,12 +53,12 @@ public class ResourcesConfig implements WebMvcConfigurer
|
|
|
CorsConfiguration config = new CorsConfiguration();
|
|
|
config.setAllowCredentials(true);
|
|
|
// 设置访问源地址
|
|
|
- config.addAllowedOrigin("*");
|
|
|
+ config.addAllowedOriginPattern("*");
|
|
|
// 设置访问源请求头
|
|
|
config.addAllowedHeader("*");
|
|
|
- // 设置访问源请求方法
|
|
|
+ // 设置访问源请求方�?
|
|
|
config.addAllowedMethod("*");
|
|
|
- // 对接口配置跨域设置
|
|
|
+ // 对接口配置跨域设�?
|
|
|
source.registerCorsConfiguration("/**", config);
|
|
|
return new CorsFilter(source);
|
|
|
}
|
|
|
@@ -66,8 +66,7 @@ public class ResourcesConfig implements WebMvcConfigurer
|
|
|
@Override
|
|
|
public void addCorsMappings(CorsRegistry registry) {
|
|
|
registry.addMapping("/**")
|
|
|
- .allowedOrigins("*")
|
|
|
- //.allowedOriginPatterns("*")
|
|
|
+ .allowedOriginPatterns("*")
|
|
|
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
|
|
|
.allowCredentials(true)
|
|
|
.maxAge(3600)
|