【发布时间】:2010-09-20 01:22:42
【问题描述】:
好的,我有一个apache IBM HTTP Server WAS 6.1 设置
我的certs 已正确安装,并且可以成功加载http 和https 页面。
通过https 成功进行j_security_check 身份验证后,我希望现在授权的页面(以及所有后续页面)加载为http。
我希望这一切都与mod_rewrite 一起工作,因为我不想为在网络服务器上真正应该简单的事情更改应用程序代码。
我认为这会起作用,但它不起作用,我担心这是因为 j_security_check 以某种方式绕过了 mod_rewrite。
RewriteCond %{HTTPS} =off
RewriteCond %{THE_REQUEST} login\.jsp.*action=init [OR]
RewriteCond %{THE_REQUEST} login\.jsp.*action=submit
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] <<-- this rule is working
RewriteCond %{HTTPS} =on
RewriteCond %{THE_REQUEST} !login\.jsp.*action=init [OR]
RewriteCond %{THE_REQUEST} !login\.jsp.*action=submit
RewriteRule .* http://%{SERVER_NAME}%{REQUEST_URI} [R,L] <--- this rule is not working or the condition is not returning true
我知道[R,L] 将强制执行的规则成为对请求运行的最后一条规则并相应地重定向。
我在谷歌搜索后发现了这颗小宝石。
mod_rewrite: My rules are ignored. Nothing is written to the rewrite log.
The most common cause of this is placing mod_rewrite directives at global scope (outside of any VirtualHost containers) but expecting the directives to apply to requests which were matched by a VirtualHost container.
In this example, the mod_rewrite configuration will be ignored for requests which are received on port 443:
RewriteEngine On
RewriteRule ^index.htm$ index.html
<VirtualHost *:443>
existing vhost directives
</VirtualHost>
Unlike most configurable features, the mod_rewrite configuration is not inherited by default within a <VirtualHost > container. To have global mod_rewrite directives apply to a VirtualHost, add these two extra directives to the VirtualHost container:
<VirtualHost *:443>
existing vhost directives
RewriteEngine On
RewriteOptions Inherit
</VirtualHost>
将 Inherit 声明添加到指向机器 ip 和 port 443 的单个 virtualhost 声明并没有帮助。
现在我知道我的应用服务器分别在 9080 和 9443 上进行通信,但我在 Web 服务器 httpd.conf 中找不到单个 virtualhost。
我在未经身份验证的情况下使用不同的重写规则进行了一些测试,发现我的mod rewrite 代码有效..
那么:如何让 websphere 在认证后使用 mod 重写?
这就像网络服务器仅用于未经身份验证的请求,然后某个黑盒容器以某种方式提供所有内容。
【问题讨论】:
标签: mod-rewrite ssl ibmhttpserver