简体   繁体   English

删除cookie的最佳方法,服务器端

[英]Best way to delete cookie, server-side

I am working with Node.js and want to delete all cookies for the browser, for my domain. 我正在使用Node.js并希望删除浏览器的所有cookie,用于我的域。 What would be the best way to do this? 最好的方法是什么? Just set them to expire, or is there another trick? 只是将它们设置为过期,还是有另一种技巧?

This is quite late, but there is a clearCookie() method on the Express response object. 这已经很晚了,但Express响应对象上有一个clearCookie()方法。 No need to use tricks, or artificially expire the cookie. 不需要使用技巧,或人为地使cookie过期。 Documentation here: https://expressjs.com/en/4x/api.html#res.clearCookie 文档: https//expressjs.com/en/4x/api.html#res.clearCookie

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM