当前位置:网站首页>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("*");
}
}
边栏推荐
猜你喜欢

科研试剂DMPE-PEG-Mal 二肉豆蔻酰磷脂酰乙醇胺-聚乙二醇-马来酰亚胺

yolov5调用ip摄像头时出现的问题

亚马逊卖家怎么提升转化率

@Autowired与@Resource区别

Mysql8.0安装教程

Using WebShell to get Shell Skills

Daily practice------There are n integers, so that the previous numbers are moved back m positions in order, and the last m numbers become the first m numbers

基于libmodbus库实现modbus TCP/RTU通信

【深度学习】从LeNet-5识别手写数字入门深度学习

MySQL分库分表
随机推荐
Mysql8.0安装教程
亚马逊卖家怎么提升转化率
小程序组件总结
支付通道对接常见的问题有哪些?
2022.7.30 js notes Operators and flow controllers, loops
每日练习------有n个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面的m个数
subprocess.CalledProcessError: Command ‘pip install ‘thop‘‘ returned non-zero exit status 1.
redis进行持久化时,有新的写操作将如何解决——写时复制
PowerManagerService灭屏超时流程
MySQL删除表数据 MySQL清空表命令 3种方法
LeetCode:746. 使用最小花费爬楼梯【动态规划】
Keil开发环境安装教程
SOCKS5
TRICK second bullet
多个el-select下拉框无法选中相同内容
MySQL常见的索引
磷脂-聚乙二醇-酰肼,DSPE-PEG-Hydrazide,DSPE-PEG-HZ,MW:5000
Mysql8创建用户以及赋权操作
OD-Model [4]: SSD
[详解C语言]一文带你玩转C语言小游戏---扫雷