Need to install PFX SSL certificate in JBoss AS 7.1.1.Final server and also need to make auto redirection from HTTP to HTTPS in URL

154 Views Asked by At

I have a Windows server where JBoss service is installed. I want to install SSL in it.

Currently my service is running on port 8667, which is http service. I have a mydomain.pfx(SSL Certificate) file.

My current URL is http://my_domain.com:8667/
I want to run the above URL as https://my_domain.com:8443/

Also I want to redirect the URL automatically from http to https.

My windows server version: Windows Server 2016 Datacenter
Java jdk version: Java version 7 Update 80 (build 1.7.0_80-b15)
JBoss version: JBoss AS 7.1.1.Final

I have created a .jks file from .pfx file using a password "Passwd"

Then I have done following changes in .\standalone\configuration\standalone.xml

From:

        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true"/>
            <connector name="ajp13" protocol="AJP/1.3" scheme="http" socket-binding="ajp" redirect-port="8443"/>
            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost"/>
                <alias name="example.com"/>
                <rewrite pattern="^/webapp/(.*?)$" substitution="/myWebapp/$1" flags="R=301,L"/>
            </virtual-server>
        </subsystem>

To:

        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true"/>
                <ssl name="myapp-ssl" key-alias="myapp" password="Passwd" certificate-key-file="myssl.jks" protocol="TLSv1"/>
            <connector name="ajp13" protocol="AJP/1.3" scheme="http" socket-binding="ajp" redirect-port="8443"/>
            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost"/>
                <alias name="example.com"/>
                <rewrite pattern="^/webapp/(.*?)$" substitution="/myWebapp/$1" flags="R=301,L"/>
            </virtual-server>
        </subsystem>
0

There are 0 best solutions below