Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

CORS wildcard origin cannot be used with credentials

Illustration without a description Illustration without a description

With credentials: include, a response that says Access-Control-Allow-Origin: * fails the browser’s CORS check. The browser makes that decision from the credential mode even if it ended up sending no cookie.

 

For a route such as /me, match Origin against a trusted allowlist. Return the exact approved origin and Access-Control-Allow-Credentials: true. If that origin-specific response can be cached, vary it by Origin. A public, anonymous route can use a wildcard when the request does not include credentials.

 

Access-Control-Allow-Origin: https://app.example.com Access-Control-Allow-Credentials: true Vary: Origin

 

Once the response becomes readable, a 401 can still mean the session cookie was never sent. Inspect the request’s cookie details and the cookie’s attributes. If the exact origin already matches but the browser still rejects the request, check whether the credentials header is missing on OPTIONS or the final response.

 

Try /me from the allowed frontend and an unlisted origin. For the allowed call, verify that the expected cookie reaches the server.