springcloud-gateway升级版本allowedOrigins要改allowedOriginPatterns

前言

报错:

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.

原因:springboot升级2.6.0后所出现的问题

解决方法:将.allowedOrigins 替换成. allowedOriginPatterns 即可。

如下图:
springcloud-gateway升级版本allowedOrigins要改allowedOriginPatterns_第1张图片

ps:这是2.3时代的配置,现在不叫这个了,要用:

springcloud-gateway升级版本allowedOrigins要改allowedOriginPatterns_第2张图片

你可能感兴趣的:(gateway,java)