How to configure a Port 8080 Redirect to HTTPS on port 8444
A common use case for this type of re-direction are applications such as JBoss that run on Tomcat that do not utilize the standard 80 port. Note that the LoadMaster can do port translation from port 80 to 8080 and 443 to 8444.
To redirect an incoming non-SSL request on port 8080 to SSL port 8444 (or 8443), a SubVS and a content rule must first be created.
The reason for this is if the incoming request is destined for port 8080, it may contain the port number attached to the host header.
First, create the rule in order to remove the port number from the host header.
|Value of Header Field to be replaced||\1|
Next, create the Virtual Service listening on port 8080 to redirect requests to port 8444 (or whatever port).
Add the rule that was created above to strip the port from the host header.
Advanced Properties > HTTP Header Modifications > Request Rules > add rule removePort
Afterwards, within the Virtual Service listening on 8080, create a SubVS and click Modify which will take you to the SubVS properties.
Within the SubVS properties, you can specify where to redirect the original request that came in on port 8080. If you use %h, then the LoadMaster will simply use the host that the was requested. The %s will contain the URI that the host originally requested.
Advanced Properties > Not Available Redirection Handling > Error Code: '302 Found' > Redirect URL: https://%h:8444%s
It's important that no Real Servers be added to this SubVS since we want the redirect to always be active.