2008-10-30 97 views
3

好吧,我有一个apache IBM HTTP Server WAS 6.1设置HTTP到HTTPS访问http使用mod_rewrite和IBM HTTP Server

我有我的certs正确安装并可以成功加载httphttps页面。

通过https成功通过j_security_check验证后,我希望现在授权的页面(和所有后续页面)加载为http

我希望这一切都与mod_rewrite一起工作,因为我不想更改应用程序代码,以便在Web服务器上执行简单的操作。

我会认为这会工作,但它不会,我担心这是因为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> 

添加继承声明,我的单virtualhost声明指向本机的ip和port 443没有帮助一位。

现在我知道,我的应用程序服务器上90809443分别进行通信,但我无法找到Web服务器httpd.conf一个virtualhost

我做了一些测试不同的重写规则而没有通过认证,看到我的mod rewrite代码工作..

所以:我怎么让WebSphere使用国防部重写身份验证后?

这就像web服务器仅用于身份认证的请求后,一些黑盒容器在某种程度上起到了一切。

回答

0

这是HTTP到HTTPS访问http

你必须把状态和像arcticle虚拟主机重写规则说,但由于某种原因继承不想工作的解决方案。

RewriteEngine on 
RewriteCond %{HTTPS} !=on 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /path/login\.jsp\ HTTP/1\.1 
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] 

    <VirtualHost 000.000.000.000:443> 
    ServerName servername 
    ServerAlias url.com machinename 
    DocumentRoot d:/ibmhttpserver61/htdocs/en_US 
    ErrorLog d:/ibmhttpserver61/logs/secerr.log 
    TransferLog d:/ibmhttpserver61/logs/sectrans.log 
    SSLEnable 
    Keyfile d:/ibmhttpserver61/ssl/ctxroot.kdb 
    SSLV2Timeout 100 
    SSLV3Timeout 1000 

    RewriteEngine On 
    RewriteCond %{REQUEST_URI} /path/secure/index.jsf 
    RewriteRule ^(.*)$ http://url/path/secure/index.jsf [R,L]  

    </VirtualHost> 
-1

野生猜测:应所述第二逻辑OR是AND(即无[OR]和的RewriteCond默认为AND)?

RewriteCond %{THE_REQUEST} !login\.jsp.*action=init 
RewriteCond %{THE_REQUEST} !login\.jsp.*action=submit