I'm implementing CORS (Cross-origin resource sharing) in a framework.
I know that when an XMLHttpRequest request is made using Jquery's ajax(...)
and the withCredentials
property is true
, the server must respond those two things:
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin:[THE_DOMAIN]
The server can't response with a wildcard, Access-Control-Allow-Origin:*
: that doesn't work!
My question: how do I know, on the server, that withCredentials: true
has been used, so I don't use the wildcard?
I compared the headers sent when using withCredentials: false
and when using withCredentials: true
and they are identical!
So, if I do want to allow credentials when the client requests it, does it mean I can't, ever, use Access-Control-Allow-Origin:*
?