最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

To allow credentials to a set of origins, list them explicitly or consider using “allowedOriginPatte

业界 admin 3浏览 0评论

在spring5.3之后,使用

        corsConfiguration.addAllowedOrigin("*");

会抛出异常 

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.

引起在5.3之后,引入了

corsConfiguration.addAllowedOriginPattern("*")

所以请替换使用

在spring5.3之后,使用

        corsConfiguration.addAllowedOrigin("*");

会抛出异常 

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.

引起在5.3之后,引入了

corsConfiguration.addAllowedOriginPattern("*")

所以请替换使用

发布评论

评论列表 (0)

  1. 暂无评论