apache tomcat + apache httpd + mod_proxy + mod_rewrite +表单发布数据

时间:2012-09-04 07:30:56

标签: apache mod-rewrite http-post reverse-proxy mod-proxy

请帮帮我。我确实试图在这里找到类似的问题阅读旧帖子,但我没有找到任何东西。 我的帖子数据有问题。 我正在使用Apache tomcat + ajp + Apache Httpd 2.2 这是我的 httpd.conf

的一部分
#Application has context url = konakart, and tomcat post 8789 for ajp
#I want to avoid typing port in my URL
ProxyPass / ajp://localhost:8789/konakart/

#pretty urls
#I don't want to type http://myshop.com/konakart
#I want http://myshop.com
#I want to put away /konakart/ from URL
RewriteEngine on
Options +FollowSymlinks
RewriteRule ^/konakart/(.*) /$1 [R=301,L] 
RewriteRule send-mail index.php?send-mail [NC,P]

一切都好......除了POST数据丢失。 似乎是因为R = 301。但是我不能放弃R = 301。如果我这样做没有任何作用。 我正在使用VDS,所以我可以做任何事...... 请帮助我克服这个问题。:(

1 个答案:

答案 0 :(得分:0)

这是mod_rewrite和GWT以及我的卷曲手的组合问题;) 这是有效的httpd.conf代码,请参阅代码中的注释:

    #Tomcat through Apache httpd
    ProxyPass /konakart ajp://localhost:8789/konakart
    ProxyPass / ajp://localhost:8789/konakart/

    #pretty urls

    RewriteEngine on
    Options +FollowSymlinks
#do not do anything for POST actions and GWT stuff. It's better not to touch it at all.
#mod_rewrite breaks interconnection of GWT RPC calls.
    RewriteCond  %{REQUEST_URI} !/(.*)EditCartSubmit\.do(.*)
    RewriteCond  %{REQUEST_URI} !/(.*)Submit\.do(.*)
    RewriteCond  %{REQUEST_URI} !/(.*)\.cache\.html
    RewriteCond  %{REQUEST_URI} !/(.*)\.nocache\.(.*)\.js
#Previously GWT servlet had mapping "/konakart"
#I've renamed it to "/KonakartGWTServlet"
    RewriteCond  %{REQUEST_URI} !/KonakartGWTServlet
    RewriteRule ^/konakart/(.*) /$1 [R=301,L]