中文 English

Fixing CORS Issues When Upgrading from Spring 2.3.x to a Newer Version

Published: 2023-03-12
Java springfox springboot spring

Exception Message:

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.

Solution:

CORS configuration error, simply replace .allowedOrigins with .allowedOriginPatterns.