We recently migrated an API application from Azure Cloud Services to Azure Websites, and some clients are still using our legacy protocol for authentication, which uses cookies (instead of the usual Authorization: Bearer
HTTP header). We need to support this authentication protocol for a little longer as the clients will not be able to migrate right away.
To support cookies in a cross-origin ajax request directed to the API, the client needs to set the withCredentials
setting to true
in the XMLHttpRequest, and the server needs to repond with the Access-Control-Allow-Credentials
header as well to any CORS request.
The problem we face is that the Azure Website manages CORS all by itself, and uses its own configuration (which is limited to a list of allowed origins) for the response, which does not allow this header to be set... thus breaking the application for all our Ajax clients!
Is there a way to (temporarily) add this header in the responses?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…