[英]Clear all cookies in NodeJS
This answer shows how to clear a single cookie in NodeJS. 该答案显示了如何清除NodeJS中的单个cookie。 Is there a function to clear all cookies without iterating through all of them and clearing them (or expiring them) individually?
是否具有清除所有cookie的功能,而不需要遍历所有cookie并逐个清除(或使它们过期)?
No, there isn't. 不,没有。 According to RFC for Cookies, a server shouldn't sent multiple responses to clear cookie even.
根据RFC的Cookie规定,服务器甚至不应发送多个响应来清除Cookie。
If a server sends multiple responses containing Set-Cookie headers concurrently to the user agent (eg, when communicating with the user agent over multiple sockets), these responses create a "race condition" that can lead to unpredictable behavior.
如果服务器同时向用户代理发送包含Set-Cookie标头的多个响应(例如,当通过多个套接字与用户代理通信时),则这些响应会创建“竞争条件”,从而导致无法预测的行为。
ALso, you should only be able to send one value for Set-Cookie
, even in order to unset a cookie. 同样,即使为了取消设置cookie,您也只能为
Set-Cookie
发送一个值。
Read More: https://tools.ietf.org/html/rfc6265 [Pg 9] 阅读更多: https : //tools.ietf.org/html/rfc6265 [Pg 9]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.