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.
把
config.addAllowedOrigin("*");
改为
config.addAllowedOriginPattern("*");
本文介绍如何解决在配置跨域访问时遇到的java.lang.IllegalArgumentException错误。当需要支持带有凭据的跨域请求,并使用通配符*时,应采用allowedOriginPatterns而非allowedOrigins。文中给出了具体的代码修改建议。
835

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



