Here how to set substitution to any address so that I can use it in AWS Application Load Balancer.
<subsystem xmlns="urn:jboss:domain:web:2.2" 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" enable-lookups="false" secure="true" />
<virtual-server name="default-host" enable-welcome-root="true">
<rewrite pattern="^/(.*)$" substitution="https://localhost:443/$1" flags="RL">
<condition test="%{HTTPS}" pattern="off" />
</rewrite>
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
I want like
<rewrite pattern="^/(.*)$" substitution="https://%HOST_NAME%" flags="RL">
<condition test="%{HTTPS}" pattern="off" />
</rewrite>
Here are the steps to redirect from http to https in EAP 6,
Add redirect-port="443" to http connector as follows :
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="443"/>
Change the socket-binding of https to 443 as follows :
<socket-binding name="https" port="443"/>
Configure https connector in EAP 6,
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl name="ssl" key-alias="mykey" password="password" certificate-key-file="/path/to/keystore.jks"/>
</connector>
Edit the web.xml of application as follows:-
<web-app>
<security-constraint>
<web-resource-collection>
<web-resource-name>Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
</web-app>