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

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

问题描述

我需要从获取到服务器的HTTP请求删除的cookie。这样做的客户端(即写入该cookie)或服务器(读取它)上是不是一种选择。我的Apache 2.0来代理客户端和服务器之间的请求,所以我希望使用mod_rewrite删除cookie的正确的,在Apache的。

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.

推荐答案

阿帕奇的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。

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天全站免登陆