I am running tomcat on centos6. I'm trying to configure Apache as a front end to tomcat so I could access:
help-test.example.com:8080/4-3/help help-test.example.com:8080/4-2/help help-test.example.com:8080/4-1/help
via:
help-test.example.com/4-3/help help-test.example.com/4-2/help help-test.example.com/4-1/help
with below apache configuration it is working:
VirtualHost *:443>
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ServerName help-test.example.com:443
ServerAdmin [email protected]
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
ProxyRequests Off
ProxyPreserveHost On
Order deny,allow
Allow from all
ErrorLog /var/log/httpd/error-ssl.log
CustomLog /var/log/httpd/access-ssl.log combined
RewriteLog "/var/log/httpd/rewrite-ssl.log"
RewriteLogLevel 3
/VirtualHost>
VirtualHost *:80>
ServerName help-test.example.com
Redirect / https://help-test.example.com
/VirtualHost>
but one more thing needs also to be done when I access :
help-test.example.com/help --> help-test.example.com/4-3/help
I have tried to add:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/help/
RewriteRule (.*) /4-3/help [L,NE,R]
getting an error: This web page has a redirect loop
192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab202a8/initial] (2) init rewrite engine with requested uri /4-3/help 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab202a8/initial] (3) applying pattern '(help)' to uri '/4-3/help' 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab202a8/initial] (2) rewrite '/4-3/help' -> '/4-3/help' 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab202a8/initial] (2) explicitly forcing redirect with https://help-test.example.com/4-3/help 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab202a8/initial] (1) redirect to https://help-test.example.com/4-3/help [REDIRECT/302] 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab0c308/initial] (2) init rewrite engine with requested uri /4-3/help 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab0c308/initial] (3) applying pattern '(help)' to uri '/4-3/help' 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab0c308/initial] (2) rewrite '/4-3/help' -> '/4-3/help' 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab0c308/initial] (2) explicitly forcing redirect with https://help-test.example.com/4-3/help 192.168.1.40 - - [26/Mar/2015:10:13:26 +0000] [help-test.example.com/sid#7f89baa41700][rid#7f89bab0c308/initial] (1) redirect to https://help-test.example.com/4-3/help [REDIRECT/302]