intermediateCORS: Cross-Origin Resource Sharing

Why is allowedOrigins('*') combined with allowCredentials(true) rejected by browsers?

Allowing every origin to make credentialed (cookie-carrying) requests would let ANY website — including malicious ones — silently issue authenticated requests using a victim's existing session cookie, defeating the entire purpose of CORS as a protective boundary. Browsers enforce that a wildcard origin cannot be combined with credentials; you must list specific allowed origins (or patterns) instead.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.

Why is allowedOrigins('*') combined with allowCredentials(true) rejected by browsers?

Next Step

Continue to Is CORS a substitute for authentication/authorization?← Back to all Spring Security questions