Hello friends,

I am working on a Debian server in which I would like to setup 2 instances
of Apache tomcat which will be load balanced by an Apache HTTP server(Do I
require a http server? ). In-case one copy of Apache tomcat goes down, the
other one will automatically comes online.

While I was creating a configuration for one of our server, I know how to
relay requests based upon URL to Apache Tomcat, these are the 2 things I
don't know.

1) Will this work with https? Reason I ask is, there are many pages which
are served under https and the configuration which I have and shown below
seems to be calling with http instead of https.

2) How to trigger the 2nd copy of tomcat.

Here is what I have till  now in Apache web server :

// Below is the redirection for tomcat webapps.
<VirtualHost *:80>
ServerName www.domain_tomcat.de
ServerAlias domain_tomcat.de
ProxyRequests on
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

// I was thinking instead of routing to maintenance.html, I would start the
other app, but that sounds quite hackish. I thought there might be a better
way.
 ErrorDocument 503 /maintenance.html
 ErrorDocument 404 /maintenance.html
 ErrorDocument 500 /maintenance.html

ProxyPass /maintenance.html !

// As you can see below, I am redirecting with http, which is my first
point, will it automatically redirect to https, as tomcat webapp is using
Spring-security and it has specific paths for which it must use https.
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

<Location / >
Order allow,deny
Allow from all
</Location>
</VirtualHost>

My tomcat config is rather simple :


<Connector port="8080" proxyPort="80" redirectPort="443"
protocol="org.apache.coyote.http11.Http11NioProtocol" compression="force"
compressionMinSize="1024"
               connectionTimeout="20000"  maxPostSize="5242880"
               URIEncoding="utf-8"
 compressableMimeType="text/html,text/xml,text/plain,text/css,text/
javascript,application/x-javascript,application/javascript"/>


 <Connector port="443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
maxPostSize="5242880" SSLEnabled="true" maxThreads="200" compr$
              compressionMinSize="1024" scheme="https" secure="true"
clientAuth="false"  sslProtocol="TLS"
               keystoreFile="keystore.jks" keystorePass="PASSWORD"
URIEncoding="utf-8"
 compressableMimeType="text/html,text/xml,text/plain,text/css,text/
javascript,application/x-javascript,application/javascript"/>

I can setup a similar instance of Tomcat in another location if desired.
But how can I handle the switching between them when one goes down. Kindly
let me know. Thank you. :-)

Reply via email to