mod_proxy可以使用params处理GET响应(使用tomcat作为后端)

时间:2012-11-20 13:30:32

标签: apache tomcat mod-proxy

我有Apache反向代理,它是使用mod_jk连接tomcat的后端Apache的请求,应用程序在java / jsps中 在Apache反向代理中,我有这样的配置,当GET请求中存在带有out参数的请求时,该配置有效:

ProxyRequests     Off
ProxyPreserveHost On
ProxyPass /users/ http://1x2.xxx.4.xx:5xxxx/jsp/app/New/
ProxyPassReverse /users/  http://1x2.xxx.4.xx:5xxxx/jsp/app/New/
CustomLog /home/Apache/logs/proxy_log common

mod_proxy日志:

1xx.1xx.3.xx - - [20/Nov/2012:14:07:54 +0200] "GET /users/ HTTP/1.1" 200 3547
1xx.1xx.3.xx - - [20/Nov/2012:14:07:57 +0200] "GET /users/ HTTP/1.1" 200 3547
1xx.1xx.3.xx - - [20/Nov/2012:14:07:58 +0200] "GET /users/index.jsp?event=pi&id=&p= HTTP/1.1" 200 3615
1xx.1xx.3.xx - - [20/Nov/2012:14:08:02 +0200] "GET /users/ HTTP/1.1" 200 3547
1xx.1xx.3.xx - - [20/Nov/2012:14:08:07 +0200] "GET /users/index.jsp?event=pi&id=test&p=test HTTP/1.1" 200 3615
1xx.1xx.3.xx - - [20/Nov/2012:14:16:48 +0200] "GET /users/ HTTP/1.1" 200 3547
1xx.1xx.3.xx - - [20/Nov/2012:14:27:05 +0200] "GET /users/index.jsp?event=pi&id=test&p=test HTTP/1.1" 302 -
1xx.1xx.3.xx - - [20/Nov/2012:14:27:05 +0200] "GET /jsp/app/New/Home.jsp?event=Validated HTTP/1.1" 404 306
1xx.1xx.3.xx - - [20/Nov/2012:14:29:25 +0200] "GET /users/index.jsp?event=pi&id=test&p=test HTTP/1.1" 302 -
1xx.1xx.3.xx - - [20/Nov/2012:14:29:25 +0200] "GET /jsp/app/New/Home.jsp?event=Validated HTTP/1.1" 404 306
1xx.1xx.3.xx - - [20/Nov/2012:15:11:37 +0200] "GET /users/ HTTP/1.1" 200 3547
1xx.1xx.3.xx - - [20/Nov/2012:15:11:44 +0200] "GET /users/index.jsp?event=pi&id=test&p=test HTTP/1.1" 302 -
1xx.1xx.3.xx - - [20/Nov/2012:15:11:45 +0200] "GET /jsp/app/New/Home.jsp?event=Validated HTTP/1.1" 404 306

每次收到回复时都可以看到:

"GET /jsp/app/New/Home.jsp?event=Validated HTTP/1.1" 404 306

失败了 当我尝试在没有代理服务器的情况下直接使用它时页面正常工作。

1 个答案:

答案 0 :(得分:0)

你需要使用Apache Httpd v2.2 +并在ProxyPass配置中指定'nocanon'选项,它告诉Apache不要规范请求查询字符串:

ProxyPass /users/ http://1x2.xxx.4.xx:5xxxx/jsp/app/New/ nocanon