|
@@ -1,13 +1,11 @@
|
|
|
package com.github.jfcloud.gene.config;
|
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
-/**
|
|
|
- * @author zj
|
|
|
- * @date 2022/6/20
|
|
|
- */
|
|
|
+@Slf4j
|
|
|
@Configuration
|
|
|
public class CorsConfig implements WebMvcConfigurer {
|
|
|
|
|
@@ -15,16 +13,10 @@ public class CorsConfig implements WebMvcConfigurer {
|
|
|
public void addCorsMappings(CorsRegistry registry) {
|
|
|
//解决跨域问题
|
|
|
registry.addMapping("/**")
|
|
|
- .allowedOrigins("*")
|
|
|
- .allowedMethods("GET", "HEAD", "POST","PUT", "DELETE", "OPTIONS")
|
|
|
+ .allowedOriginPatterns("*")
|
|
|
+ .allowedMethods("*")
|
|
|
.allowedHeaders("*")
|
|
|
- .exposedHeaders("access-control-allow-headers",
|
|
|
- "access-control-allow-methods",
|
|
|
- "access-control-allow-origin",
|
|
|
- "access-control-max-age",
|
|
|
- "X-Frame-Options")
|
|
|
- .allowCredentials(false)
|
|
|
- .maxAge(3600);
|
|
|
- WebMvcConfigurer.super.addCorsMappings(registry);
|
|
|
+ .allowCredentials(true);
|
|
|
}
|
|
|
}
|
|
|
+
|