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

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

我已经在 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 可以 updated/redirected 到 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