package cn.kongwg.es.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author kongwg
* @create 2021-04-02 20:55
*/
@Configuration
public class MyWebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedHeaders("*")
.allowedMethods("*")
.allowCredentials(true)
.allowedOrigins("http://localhost:8081")
.maxAge(2000);
}
}
版权声明:本文为kong240524885原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。