SpringBoot 配置全局Cors跨域 @Configuration public class CorsConfig { @Bean public WebMvcConfigurer configurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/common/**") .allowedOrigins("http://localhost:8080") .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTION") .maxAge(100); } }; } }
SpringBoot CORS跨域配置
最新推荐文章于 2023-09-26 10:01:43 发布