|
@@ -3,6 +3,7 @@ package com.sxtvs.open.core.conf;
|
|
|
import com.sxtvs.open.core.auth.LoginInterceptor;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.web.cors.CorsConfiguration;
|
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
@@ -12,9 +13,11 @@ public class WebConfig implements WebMvcConfigurer {
|
|
|
@Override
|
|
|
public void addCorsMappings(CorsRegistry registry) {
|
|
|
registry.addMapping("/**")
|
|
|
- .allowedMethods("*")
|
|
|
- .allowedOrigins("*")
|
|
|
- .allowedHeaders("*");
|
|
|
+ .allowedOriginPatterns("*")
|
|
|
+ .allowCredentials(true)
|
|
|
+ .allowedHeaders(CorsConfiguration.ALL)
|
|
|
+ .allowedMethods(CorsConfiguration.ALL)
|
|
|
+ .maxAge(3600);
|
|
|
}
|
|
|
|
|
|
@Override
|