3

わかりました、apache IBM HTTP Server WAS 6.1セットアップができました

certs正しくインストールされ、ページを正常にロードできhttpますhttps

j_security_check経由で認証が成功した後https、現在承認されているページ (および後続のすべてのページ) を としてロードしhttpます。

mod_rewriteWebサーバー上で本当に簡単に実行できるはずのアプリケーションコードを変更したくないので、これをすべて機能させたいと思っています。

これはうまくいくと思いますが、そうではなく、何らかの形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を指す単一の宣言にInherit宣言を追加しても、port 443少しは役に立ちませんでした。

これで、アプリ サーバーが9080と でそれぞれ通信していることがわかりましたが、Web サーバーで94431 つが見つかりません。virtualhosthttpd.conf

認証されていないときに、さまざまな書き換えルールでいくつかのテストを行い、mod rewriteコードが機能することを確認しました..

では、認証後に websphere に mod rewrite を使用させるにはどうすればよいですか?

Web サーバーは認証されていないリクエストにのみ使用され、その後、何らかのブラックボックス コンテナーが何らかの方法ですべてを提供するようです。

4

2 に答える 2

0

これは、http から https から http へのソリューションです。

アークティクルが言ったように、仮想ホストに条件と書き換えルールを配置する必要がありますが、何らかの理由で継承が機能しませんでした。

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>
于 2008-10-31T14:44:12.203 に答える
-1

大まかな推測: 2 番目の論理 OR は AND にする必要がありますか (つまり、[OR] がなく、RewriteCond のデフォルトが AND になります)?

RewriteCond %{THE_REQUEST} !login\.jsp.*action=init
RewriteCond %{THE_REQUEST} !login\.jsp.*action=submit
于 2008-10-30T21:44:16.073 に答える