如何删除Apache中的cookie [英] How to remove a cookie in Apache

查看:29
本文介绍了如何删除Apache中的cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从到达服务器的 HTTP 请求中删除一个 cookie.在客户端(写入此 cookie)或在服务器(读取它)上执行此操作不是一种选择.我有 Apache 2.0 代理客户端和服务器之间的请求,所以我希望使用 mod_rewrite 删除 Apache 中的 cookie.

I need to remove a cookie from the HTTP request that gets to the server. Doing it on the client (that writes this cookie) or on the server (that reads it) is not an option. I have Apache 2.0 that proxies requests between client and the server, so I was hoping to remove the cookie right there in Apache using mod_rewrite.

我的问题是,有没有办法使用 mod_rewrite 从 HTTP 请求中删除某个 cookie?

My question is, is there a way to remove a certain cookie from the HTTP request using mod_rewrite?

如果不能只删除一个 cookie,那么作为最后的手段从请求中删除所有 cookie?

If not possible to remove just one cookie then as a last resort to remove all cookies from the request?

如果 mod_rewrite 不是执行此任务的正确工具,我愿意接受其他有关如何完成此任务的建议.

I am open to other suggestions of how to accomplish this if mod_rewrite is not the right tool for this task.

推荐答案

Apache mod_rewrite 允许操作 URL 而不是 HTTP 标头,但是 'mod_headers' 会让你这样做.

Apache mod_rewrite allows manipulation of URLs but not of HTTP headers, however 'mod_headers' will let you do that.

所以,你可以使用:

RequestHeader unset Cookie

这将从请求中去除所有 cookie.我不确定是否可以使用这种技术只删除一个特定的 cookie.

This will strip all cookies from the request. I'm not sure if its possible to remove just a particular cookie using this technique.

或者,您可以使用以下方法停止将 cookie 传递回客户端:

Alternatively, you can stop cookies being passed back to the client using:

Header unset Set-Cookie

如果这样更合适.

这篇关于如何删除Apache中的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆