Why does expressjs send a Set-Cookie header with every OPTIONS response?

I noticed that my express server sends a header Set-Cookiein response to every request OPTIONSmade by my external Angular.js project.

A cookie has a new meaning for each request OPTIONS, but is never saved on Chrome.

When I use pass.js to authenticate the user, the response to the request POSThas the same header (again with a new cookie), but this time I see that it is stored and sent with subsequent requests in the header Cookie.

What express module does this and why? And why doesn't Chrome store a cookie?

This is more of a curiosity than anything, as it does not cause any problems (it just caused a lot of confusion when trying to track one shot).

+4
source share
2 answers

The OPTIONS method should not have a side effect. See HTTP 1.1 documentation

OPTIONS is a request for information on the server. Such a request is not considered as a real interaction between the user and the server. The server probably makes the information available to all users.

cookie, . , cookie . , , .

+2

Source: https://habr.com/ru/post/1539385/


All Articles