如何使用Apache mod_rewrite读取POST参数,cookie或HTTP标头 [英] How to read POST parameters, cookies or HTTP headers using Apache mod_rewrite

查看:223
本文介绍了如何使用Apache mod_rewrite读取POST参数,cookie或HTTP标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Tomcat 6下运行的应用程序.在它前面,我有 正在转发所有请求的Apache服务器.也就是说,用户交谈" 到Apache,而不是Tomcat.由于某种原因,Apache服务器收到对该URL的请求:

I have an application running under Tomcat 6. In front of it I have an Apache server which is forwarding all requests. That is, the user "talks" to Apache and not to Tomcat. For some reason the Apache server receives a request to the URL:

http://www.example.com/myApp

然后必须将其转发到http://www.example.com/$PREFIX/myApp

其中,$PREFIX是POST参数.此$PREFIX参数也可用 作为COOKIE和额外的标题.

where $PREFIX is a POST parameter. This $PREFIX parameter is also available as a COOKIE and as an extra header.

我找不到使用mod_rewrite读取POST参数/cookies/标题的方法.

I couldn't find a way using mod_rewrite to read POST parameters/cookies/headers.

这有可能吗?如果没有,我应该使用其他Apache模块/连接器吗?

Is this possible at all? If not, should I use another Apache module/connector?

推荐答案

您不能将POST数据用于mod_rewrite.这是因为POST数据不在http请求的HEADER中,而在BODY中.

You can't use POST data for mod_rewrite. This is because the POST data isn't in the HEADER of the http request, it's in the BODY.

我的建议是,您在发布页面上执行一个将前缀添加到URL的操作,这意味着您甚至不需要重写.

My suggestion would be that you perform an action on the posting page that adds the prefix to the URL, which would mean you don't even need to rewrite.

这篇关于如何使用Apache mod_rewrite读取POST参数,cookie或HTTP标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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