问题描述
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.
解决办法
错误是因为Spring boot版本过高,从而导致跨域未生效,我使用的是2.4.0报错,修改为2.3.0.RELEASE版本问题得到解决。
当使用SpringBoot版本2.4.0及以上时,遇到一个IllegalArgumentException,原因是跨域配置不生效。错误信息提示在allowCredentials为true的情况下,不允许'*'作为allowedOrigins的值。解决方法是将SpringBoot版本回退到2.3.0.RELEASE,问题即可得到解决。
999

被折叠的 条评论
为什么被折叠?



