Https from Apache to JBoss

From Initq
Jump to: navigation, search

This article will show step my step how to get Apache SSL to forward all traffic to JBoss and have a secure packet transfer.


JBoss Setup

We are assuming that JBoss is all set up and you also have your application running on port 8080 which the default port for JBoss.

Set up Apache

Download Apache from and test the server by going to the main page from a different machine to make sure Apache is all working.

Generate SSL certs

Below commands will gererate the key files, then you will need the csr file and then we will create the actual certificate. The last command removes the pass phrase from the key.

openssl genrsa -des3 -out dominion.key 4096
openssl req config openssl.cnf -new -key dominion.key -out dominion.csr
openssl x509 -req -days 365 -in dominion.csr -signkey dominion.key -out dominion.crt
openssl rsa -in dominion.key -out dominion.key.insecure

Copy all these 4 files into Apache/conf/certs directory.

Enable Modules in httpd.conf

Uncomment the below modules.

Listen 443
LoadModule ssl_module modules/
LoadModule proxy_module modules/
LoadModule proxy_ajp_module modules/
LoadModule proxy_balancer_module modules/
LoadModule proxy_connect_module modules/
LoadModule proxy_ftp_module modules/
LoadModule proxy_http_module modules/
LoadModule rewrite_module modules/
LoadModule setenvif_module modules/
Include conf/extra/httpd-vhosts.conf

Add the following in the httpd-vhosts.conf file

Delete the original file that came with Apache and replace it with the following httpd-vhosts.conf file.

<VirtualHost *:80>
 ProxyPreserveHost On
 ProxyPass /
 ProxyPassReverse /
<VirtualHost *:443>
 SSLEngine On
 SSLCertificateFile "C:\Program Files\Apache Software Foundation\Apache2.2\conf\certs\dominion.crt"
 SSLCertificateKeyFile "C:\Program Files\Apache Software Foundation\Apache2.2\conf\certs\dominion.key.insecure"
 ProxyPreserveHost On
 ProxyPass /
 ProxyPassReverse /

Edit JBoss Root Doc file

This file is located at

  • jboss-4.2.3\server\default\deploy\jboss-web.deployer\ROOT.war

Move the old index.html file to Index2.html and create a index.html file with the following in it.

document.location.href = '';