如何在WebSphere Application Server v9上将URL http重定向到https

问题描述

我已经在WebSphere Application Server v9.0上部署了一个应用程序,并通过在httpd.conf文件添加以下内容为该应用程序启用了SSL(侦听端口443),

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

我现在可以使用URL https://srvrname/jde/E1Menu.maf

成功访问该应用程序。

用户在浏览器中输入http://srvrname/jde/E1Menu.maf时,是否可以将URL更新/重定向到https://srvrname/jde/E1Menu.maf。谢谢!

解决方法

通过将以下内容添加到httpd.conf中来使用rewrite_module:

LoadModule rewrite_module modules/mod_rewrite.so

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

完整的文档可以在这里找到:https://www.ibm.com/support/pages/node/72233