当前位置:网站首页>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("*");
}
}
边栏推荐
- Redis笔记基础篇:6分钟看完Redis的八种数据类型
- 【深度学习】从LeNet-5识别手写数字入门深度学习
- 磷脂-聚乙二醇-靶向新生血管靶向肽APRPG,DSPE-PEG-APRPG
- 关于跨域问题
- [Remote Control Development Basic Tutorial 3] Crazy Shell Open Source Formation UAV-ADC (Joystick Control)
- 离线数仓-用户行为采集
- [详解C语言]一文带你玩转C语言小游戏---三子棋
- LeetCode:第304场周赛【总结】
- 手把手带你 Unity 入门之从零创建一个时钟(GameObjects 与 Scripts)
- 5.nodejs--cross domain, CORS, JSONP, Proxy
猜你喜欢
随机推荐
云服务器安装部署Nacos2.0.4版本
线性代数学习笔记1:何为线性代数
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
Using WebShell to get Shell Skills
getattr()函数解析
线性代数学习笔记3-2:矩阵乘法的理解
黑马案例--实现 clock 时钟的web服务器
np.unique()函数
化学试剂磷脂-聚乙二醇-羟基,DSPE-PEG-OH,DSPE-PEG-Hydroxyl,MW:5000
MySQL中的各种锁(行锁、间隙锁、临键锁等等LBCC)
Keil development environment installation tutorial
Good Key, Bad Key (思维,临项交换,经典方法)
mysql中如何查看表是否被锁
np.isnan()
青蛙跳台阶:我如何得知它是一道斐波那契数列题?——应用题破题“三板斧”
RHCSA第三天
OD-Model [4]: SSD
rem adaptation
「PHP基础知识」空值(null)的使用
Double Strings (别总忘记substr)

[email protected]在static属性上的使用"/>





![[详解C语言]一文带你玩转C语言小游戏---扫雷](/img/9f/3979ef063f10bd641111aa4f4d8b4e.png)
