2

I have configured Apache to act as the load balancer to send http request to the JBoss. However trying to add https is proving difficult. I believe I need to use virtual host .I have the cert and key file needed , if anybody knows how to do that,please share...

Here is my httpd( relevant pieces) :

#************************************************************ 
Listen 80
# For SSL configuration, add below line also.
Listen 443
# Include mod_jk configuration file
Include conf/mod-jk.conf
#************************************************************ 

Here is my mod-jk.conf :

#************************************************************      
LoadModule jk_module modules/mod_jk.so

LoadModule ssl_module modules/mod_ssl.so

JkWorkersFile conf/workers.properties

JkLogFile logs/mod_jk.log

JkLogLevel info

JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories

JkRequestLogFormat "%w %V %T"

JkMount /__application__/* loadbalancer

JkUnMount /__application__/images/* loadbalancer

JkMountFile conf/uriworkermap.properties

JkShmFile run/jk.shm

<Location /jkstatus>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.140.128
</Location>
#************************************************************ 

Here is my workers.properties :

 #************************************************************ 
    worker.list=loadbalancer,status

    worker.node1.port=8009
    worker.node1.host=192.168.140.128
    worker.node1.type=ajp13
    worker.node1.lbfactor=1
    worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
    worker.node1.connect_timeout=10000 #Not required if using ping_mode=A
    worker.node1.ping_mode=A #As of mod_jk 1.2.27

    worker.loadbalancer.type=lb
    worker.loadbalancer.balance_workers=node1
    worker.status.type=status
#************************************************************ 

Here is my server.xml (in JBoss) :

   <Server>

   <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
   <Listener className="org.apache.catalina.core.JasperListener" />
 <Service name="jboss.web">
      <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" 
               connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>
         <Connector port="8009" address="${jboss.bind.address}"
      emptySessionPath="true" enableLookups="false" redirectPort="8443" 
      protocol="AJP/1.3" connectionTimeout="600000" maxThreads="200"/>

     <Engine name="jboss.web" defaultHost="v-77-if-vm.us.nohsib.com" jvmRoute="node1">
         <Realm className="org.jboss.web.tomcat.security.JBossWebRealm"
            certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
            allRolesMode="authOnly"
            />

         <Host name="v-77-if-vm.us.nohsib.com"> 
            <Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve"
                cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager"
                transactionManagerObjectName="jboss:service=TransactionManager" />

         </Host>
      </Engine>
   </Service>
</Server>
Nohsib
  • 3,614
  • 14
  • 51
  • 63

1 Answers1

0

You have to add your https configuration to apache:

<IfModule ssl_module>
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM


#CA certificates for root and intermediate
SSLCACertificateFile "C:/production/certs/provider/providerRoot.crt"
SSLCertificateChainFile "C:/production/certs/provider/providerIntermediate.crt"

#Generated first via openssl; Server public and private keys.
SSLCertificateFile    "C:/production/certs/provider/your.crt"
SSLCertificateKeyFile "C:/production/certs/provider/your.key"
</IfModule>

Then, under the cooresponding virtualhost, add the following:

<VirtualHost *:443>
SSLEngine On

You may also want to look into enabling https redirect using Rewrite:

RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
Jason Huntley
  • 3,827
  • 2
  • 20
  • 27