好的,我有一个apache IBM HTTP Server WAS 6.1
设置
我已经certs
正确安装并且可以成功加载http
和https
页面。
通过 成功j_security_check
验证后https
,我希望现在授权的页面(以及所有后续页面)加载为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 声明添加到我virtualhost
的指向机器 ip 的单个声明中并且port 443
没有任何帮助。
现在我知道我的应用服务器分别在9080
和上进行通信,但我在 web 服务器中9443
找不到一个。virtualhost
httpd.conf
我在未经过身份验证的情况下使用不同的重写规则进行了一些测试,发现我的mod rewrite
代码有效..
那么:如何让 websphere 在身份验证后使用 mod 重写?
就像 Web 服务器仅用于未经身份验证的请求,然后某个黑盒容器以某种方式提供所有内容。