后端跨域配置类
作者:互联网
@Configuration public class CorsConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**")//所有接口都支持跨域 .allowedOriginPatterns("*")//所有地址都可访问 .allowCredentials(true) .allowedMethods("*")//"GET","HEAD","POST","PUT","DELETE","OPTIONS" .maxAge(3600);//允许跨域时间 } }
TRANSLATE with x English TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back
标签:TRANSLATE,跨域,后端,配置,location,document,true,public 来源: https://www.cnblogs.com/lyj0810/p/16313211.html