跳至主要內容

配置了APACHE和TOMCAT整合后,firefox中的window.parent.document不能用(http_proxy的端口问题)

Mr.Chen大约 1 分钟文章Java

我在linux上使用http_proxy的方式配置了apache跟tomcat的负载均衡,后来发现在firefox中
window.parent.document.getElementById("menu").src="content/contentNav.jsp";
没有反应,不能跳转.但是在IE上是可以的.在firebug中有这样一个错误提示
"http://www.328g.com:88open in new window à³CPÎ http://www.328g.comopen in new window ûÖ^' Window.document".

后来用alert测试过,发现页面basePath中的端口是tomcat的端口,而网站地址本来是apache端口的.到现在还没弄明白http_proxy的原理.应该是apache发现jsp请求后直接转到tomcat处理,所以basePath的端口是tomcat的端口.发现http_proxy不好用后,打算改成用mod_jk,再用alias将虚拟路径指向到项目地址.之后又出问题,发现不能正确跳转,试了很长时间,最后加了DirectoryIndex才最终解决问题,原来是我项目默认页面是login.jsp,而apache本来就没有设,

最后,贴出apache的VirtualHost配置,以便以后查阅.

<VirtualHost *:80> 
  DocumentRoot "/home/isp/webapps/hostroot/328g.com" 
  DirectoryIndex index.html index.htm index.php login.jsp index.jsp 
  ServerName 328g.com 
  ServerAlias www.328g.com *.328g.com 
  ErrorLog "logs/328g.com-error_log 
  CustomLog "logs/328g.com-access_log" common 
  # ProxyRequests off 
  # ProxyPass /isp_ims http://www.328g.com:88/isp_ims 
  # ProxyPassReverse /isp_ims http://www.328g.com:88/isp_ims 
  ProxyPass /isp_mail ! 
  ProxyPass /isp_mysql ! 
  ProxyPass /isp_help ! 
  # ProxyPass / http://www.328g.com:88/ 
  # ProxyPassReverse / http://www.328g.com:88/ 
  JkMount /*.action ajp13 
  JkMount /*.jsp ajp13 
  Alias /isp_ims /home/isp/webapps/ims 
  Alias /isp_mail /home/isp/webapps/squirrelmail 
  Alias /isp_mysql /home/isp/webapps/phpmyadmin 
  Alias /isp_help /home/isp/webapps/help 
</VirtualHost>