Troubleshooting
Problem
This document includes examples on how to rewrite requests coming in on the non-secure port to the secure port.
Resolving The Problem
This document includes examples on how to rewrite requests coming in on the non-secure port to the secure port.
In the following example, all client requests coming in on the non-secure port are redirected to the secure port:
Listen *:80
Listen *:443
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
<VirtualHost *:443>
SSLEngine On
SSLAppName QIBM_HTTP_SERVER_SAMPLESVR
SetEnv HTTPS_PORT 443
</VirtualHost>
The following example does the same as above; however, this example uses Virtual Hosts for the non-secure port instead of the Environment Variable:
Listen *:80
Listen *:443
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLAppName QIBM_HTTP_SERVER_SAMPLESVR
SetEnv HTTPS_PORT 443
</VirtualHost>
In the following example, client requests coming in on the non-secure port and containing "ebanking" in the URL are redirected to the SSL/TLS port to an application named "ebanking".
Listen *:80
Listen *:443
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^/ebanking$ https://%{SERVER_NAME}/ebanking [L,R]
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SetEnv HTTPS_PORT 443
SSLAppName QIBM_HTTP_SERVER_SAMPLESVR
</VirtualHost>
In the following example, all client requests coming in on the non-secure port are redirected to the secure port:
Listen *:80
Listen *:443
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
<VirtualHost *:443>
SSLEngine On
SSLAppName QIBM_HTTP_SERVER_SAMPLESVR
SetEnv HTTPS_PORT 443
</VirtualHost>
The following example does the same as above; however, this example uses Virtual Hosts for the non-secure port instead of the Environment Variable:
Listen *:80
Listen *:443
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLAppName QIBM_HTTP_SERVER_SAMPLESVR
SetEnv HTTPS_PORT 443
</VirtualHost>
In the following example, client requests coming in on the non-secure port and containing "ebanking" in the URL are redirected to the SSL/TLS port to an application named "ebanking".
Listen *:80
Listen *:443
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^/ebanking$ https://%{SERVER_NAME}/ebanking [L,R]
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SetEnv HTTPS_PORT 443
SSLAppName QIBM_HTTP_SERVER_SAMPLESVR
</VirtualHost>
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CGqAAM","label":"IBM i HTTP Server"},{"code":"a8m0z0000000CHLAA2","label":"IBM i HTTP Server-\u003EHTTPS SSL TLS"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
555606325
Was this topic helpful?
Document Information
Modified date:
09 September 2022
UID
nas8N1012393