Dear all,
I am having JSP page redirecting problem with apache reverse proxy and have been troubleshooting it for a month already. I really hope someone may englighten me in this thread. Really appreciate and thanks.
The infra is setup as:
Internet <--> Apache2 Reverse Proxy <--> Tomcat
1. The apache2 is purely configured as a reverse proxy server and it's URL is http://10.0.0.7/abc/mysite/
2. The Tomcat is setup to host the JSP website internally, and its URL is http://192.168.0.60/mysite/
With the configurations given below, it maps to the internal url nicely. I can see the JSP website by http://10.0.0.7/abc/mysite/
However, when I click on hyperlink on the website that does internal PAGE REDIRECT, the browser could not display the page. Apparently, the page redirect action breaks the reverse proxy.
Did i miss out anything?
My reverse proxy config:
ServerAdmin andy@xxxxxxxxxxxx ServerName 10.0.0.7 UseCanonicalName Off ServerSignature Off HostnameLookups Off ServerTokens Prod ServerRoot "/usr/local/apache2" TraceEnable Off Listen 0.0.0.0:80 NameVirtualHost 10.0.0.7:80 DocumentRoot "/www/apache2/" PidFile /usr/local/apache2/logs/httpd.pid ScoreBoardFile /usr/local/apache2/logs/httpd.scoreboard
<IfModule dir_module> DirectoryIndex index.html </IfModule>
# ================================================= # HTTP and performance settings # =================================================
Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 30
<IfModule prefork.c> MinSpareServers 5 MaxSpareServers 10 StartServers 5 MaxClients 150 MaxRequestsPerChild 0 </IfModule>
# ================================================ # PHP5 # =============================================== LoadModule php5_module modules/libphp5.so
<IfModule php5_module> AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps </IfModule>
# ================================================= # Access control # =================================================
<Directory /> Options None AllowOverride none Order deny,allow Deny from all </Directory>
<FilesMatch "^\.ht"> Order allow,deny Deny from all Satisfy All </FilesMatch>
<Directory "/usr/local/apache2/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory>
# ================================================= # MIME encoding # =================================================
<IfModule mod_mime.c> TypesConfig /usr/local/apache2/conf/mime.types </IfModule> DefaultType text/plain <IfModule mod_mime.c> AddEncoding x-compress .Z AddEncoding x-gzip .gz .tgz AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-tar .tgz AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl </IfModule>
<IfModule alias_module> ScriptAlias /cgi-bin/ /www/cgi-bin/ </IfModule>
# ================================================= # Reverse Proxy settings # =================================================
LoadModule deflate_module modules/mod_deflate.so LoadModule xmlns_module modules/mod_xmlns.so LoadModule xhtml_module modules/mod_xhtml.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule headers_module modules/mod_headers.so LoadFile /usr/lib/libxml2.so LoadModule proxy_html_module modules/mod_proxy_html.so LoadModule xml2enc_module modules/mod_xml2enc.so
<VirtualHost 10.0.0.7:80> ServerAdmin andyee@xxxxxxxxxxxxx DocumentRoot /www/apache2/ ServerName 10.0.0.7 ServerAlias 10.0.0.7 Userdir disabled
ProxyHTMLLogVerbose On LogLevel Debug ProxyRequests Off
RewriteEngine on RewriteRule ^/abc/mysite$ /abc/mysite/ [R]
ProxyPass /abc/mysite/ http://192.168.0.60/mysite/ ProxyPassReverse /abc/mysite/ http://192.168.0.60/mysite/
<Proxy *> Order Deny,Allow Allow from all </Proxy>
<Location /abc/mysite/> ProxyPassReverse / ProxyHTMLEnable On ProxyHTMLExtended On ProxyHTMLURLMap /mysite/ /abc/mysite/ RequestHeader unset Accept-Encoding ProxyHTMLLinks a href ProxyHTMLLinks area href ProxyHTMLLinks link href ProxyHTMLLinks img src longdesc usemap ProxyHTMLLinks object classid codebase data usemap ProxyHTMLLinks q cite ProxyHTMLLinks blockquote cite ProxyHTMLLinks ins cite ProxyHTMLLinks del cite ProxyHTMLLinks form action ProxyHTMLLinks input src usemap ProxyHTMLLinks head profile ProxyHTMLLinks base href ProxyHTMLLinks script src for ProxyHTMLLinks iframe src ProxyHTMLEvents onclick ondblclick onmousedown onmouseup \ onmouseover onmousemove onmouseout onkeypress \ onkeydown onkeyup onfocus onblur onload \ onunload onsubmit onreset onselect onchange ProxyHTMLURLMap url\(http://192.168.0.60/mysite([^\)]*)\) url(http://10.0.0.7/abc/mysite/ $1) Rihe </Location>
BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
ErrorLog logs/mysite-error_log CustomLog logs/mysite-access_log combined
</VirtualHost>
Best Regards, |