当前位置:网站首页>cross-domain problem solving
cross-domain problem solving
2022-08-02 03:32:00 【Tom has no Cat】
解决方案1
SpringBoot 中添加跨域配置类 CorsConfig
package com.example.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/** * 解决跨域问题 */
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
.allowCredentials(true)
.maxAge(3600)
.allowedHeaders("*");
}
}
边栏推荐
猜你喜欢
随机推荐
小程序(开发必备常识)1
MySQL分库分表
getattr()函数解析
MySQL中的各种锁(行锁、间隙锁、临键锁等等LBCC)
JJWT工具类
Day34 LeetCode
ModuleNotFoundError No module named ‘xxx‘可能的解决方案大全
Keil development environment installation tutorial
线性代数学习笔记2-1:向量和向量组、线性相关性(张成空间的概念)
每日练习------有n个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面的m个数
「PHP基础知识」PHP中对象的使用
MySQL中字符串比较大小(日期字符串比较问题)
OD-Model [4]: SSD
第十一天&shell脚本
【面经】米哈游数据开发一面二面面经
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
(forwarded) HashCode summary (2)
mysql中如何查看表是否被锁
多个el-select下拉框无法选中相同内容
离线数仓-用户行为采集