Commit 990b5f2b authored by 赵啸非's avatar 赵啸非

提交配置校验

parent 21ba4f75
...@@ -22,10 +22,10 @@ public class CorsConfig implements WebMvcConfigurer { ...@@ -22,10 +22,10 @@ public class CorsConfig implements WebMvcConfigurer {
//初始化配置对象 //初始化配置对象
CorsConfiguration configuration = new CorsConfiguration(); CorsConfiguration configuration = new CorsConfiguration();
//允许跨域访问的域名 //允许跨域访问的域名
configuration.addAllowedOrigin("*"); //configuration.addAllowedOrigin("*");
// configuration.setAllowCredentials(true); //运行携带cookie // configuration.setAllowCredentials(true); //运行携带cookie
configuration.addAllowedMethod("*"); //代表所有请求方法 //configuration.addAllowedMethod("*"); //代表所有请求方法
configuration.addAllowedHeader("*"); //允许携带任何头信息 //configuration.addAllowedHeader("*"); //允许携带任何头信息
//初始化cors配置源对象 //初始化cors配置源对象
UrlBasedCorsConfigurationSource configurationSource=new UrlBasedCorsConfigurationSource(); UrlBasedCorsConfigurationSource configurationSource=new UrlBasedCorsConfigurationSource();
...@@ -39,9 +39,9 @@ public class CorsConfig implements WebMvcConfigurer { ...@@ -39,9 +39,9 @@ public class CorsConfig implements WebMvcConfigurer {
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") registry.addMapping("/**")
.allowCredentials(true) .allowCredentials(true)
.allowedOrigins("*") //.allowedOrigins("*")
.allowedMethods(new String[] { "GET", "POST","PUT","DELETE"}) .allowedMethods(new String[] { "GET", "POST","PUT","DELETE"})
.allowedHeaders("*") // .allowedHeaders("*")
.exposedHeaders("*"); .exposedHeaders("*");
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment