问题
please help me. I did try to find similar problem here reading old posts, but I didn't find anything. I have a problem with post data. I'm using Apache tomcat + ajp + Apache Httpd 2.2 Here is a part of my 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]
Everyting is ok... except that from POST data is lost. Seems like it's because of R=301. But I can't put away R=301. If I do so nothing works. I'm using VDS so I can do anything... please help me to overcome this problem .:(
回答1:
It was combined problem of mod_rewrite and GWT and my curl hands ;) Here is valid httpd.conf code, see comments in code:
#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]
来源:https://stackoverflow.com/questions/12258698/apache-tomcat-apache-httpd-mod-proxy-mod-rewrite-form-post-data