简体   繁体   中英

How to redirect a URL http to https on WebSphere Application Server v9

I have deployed an application on WebSphere Application Server v9.0 and enabled SSL for this application (listening on port 443) by adding the below in httpd.conf file and it works just fine.

LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
<IfModule mod_ibm_ssl.c>
Listen 0.0.0.0:443
<VirtualHost *:443>
Alias /jde "Z:\IBM\WebSphere\AppServer\profiles\AppSrv/installedApps/<cellName>/<appName>.ear\webclient.war"
SSLEnable
</VirtualHost>
<Directory "Z:\IBM\WebSphere\AppServer\profiles\AppSrv/installedApps/<cellName>/<appName>.ear\webclient.war\WEB_INF">
Require all denied
</Directory>
<Directory "Z:\IBM\WebSphere\AppServer\profiles\AppSrv/installedApps/<cellName>/<appName>.ear\webclient.war">
Require all granted
</Directory>
SSLDisable
KeyFile Z:\IBM\HTTPServer/<srvrname>.kdb

I can now successfully access the application using the URL https://srvrname/jde/E1Menu.maf

Is there a way the URL can be updated/redirected to https://srvrname/jde/E1Menu.maf when a user enters http://srvrname/jde/E1Menu.maf in the browser. Thanks !

Use the rewrite_module by adding the following to the httpd.conf:

LoadModule rewrite_module modules/mod_rewrite.so

RewriteEngine on
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Full documentation can be found here: https://www.ibm.com/support/pages/node/72233

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM