当前位置:网站首页>Cross domain error: when allowcredentials is true, allowedorigins cannot contain the special value "*“
Cross domain error: when allowcredentials is true, allowedorigins cannot contain the special value "*“
2022-06-10 18:41:00 【nine point six】
The code I wrote at the beginning is like this :
@CrossOrigin(origins = "*",allowCredentials="true",allowedHeaders = "*",methods = {
})
Cross domain error reporting log
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource
[org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]:
Invocation of init method failed; nested exception is java.lang.IllegalArgumentException:
When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header.
To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.

According to the prompt, I changed the code to this :
@CrossOrigin(originPatterns = "*",allowCredentials="true",allowedHeaders = "*",methods = {
})
And then it succeeded .
If it is a configuration class
The inside addAllowedOrigin Change to allowedOriginPatterns That's it
The resistance and long , Yes, it will be
边栏推荐
- 数据可视化入门学习,要警惕陷阱误区,把握关键节点
- Uniapp native JS to convert the Gregorian calendar to the lunar calendar
- The value of Business Intelligence BI. Is visual report equal to Business Intelligence BI?
- VMware esxi version number comparison table
- After the qtmqtt source code compilation is set to keepalive, the Ping package timeout error does not return a problem repair (qmqtt:: mqttnopingresponse, qmqtt:: clientprivate:: onpingtimeo)
- 作为程序员,对于底层原理真的有那么重要吗?
- 用基础比率重写清晰的贝叶斯公式
- Form form of the uniapp uview framework, input the verification mobile number and verification micro signal
- AOV network topology sorting
- Google Earth Engine(GEE)——哥白尼大气监测 (CAMS) 全球气溶胶AOI近实时观测数据集
猜你喜欢
随机推荐
Step on the pit. The BigDecimal was improperly used, resulting in P0 accident!
SaleSmartly | 再添新渠道Slack,助你拉近客户关系
换根呀呀啊呀
[QNX hypervisor 2.2 user manual] 3.2.2 VM configuration example
锐捷x32pro刷openwrt开启无线160MHz
"Digital transformation, data first", talk about how important data governance is to enterprises
阅读micropyton源码-添加C扩展类模块(1)
c语言---8 初识常见关键字
一道题讲解动态规划的前世今生
leecode27,977-双指针法
In the digital age, why should enterprises make digital transformation?
c语言---5 初识字符串、转义字符、注释
Wireshark学习笔记(一)常用功能案例和技巧
After the qtmqtt source code compilation is set to keepalive, the Ping package timeout error does not return a problem repair (qmqtt:: mqttnopingresponse, qmqtt:: clientprivate:: onpingtimeo)
How to realize the management "desire" of Business Intelligence BI service objects and enterprise managers?
c语言---3 初识变量
muduo源码剖析——以三个切片浅析muduo库代码设计的严谨性、高效性与灵活性
企业管理者的质疑,这么多年的信息化,我们的钱花哪去了?
低碳数据中心建设思路及未来趋势
将同一文件夹下的大量文件根据设定分至多组









