2008-10-30 92 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