問題タブ [tomcat-valve]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
tomcat - Tomcat バルブが呼び出されないのはなぜですか?
コネクタなどに関係なく、名前が一致するホストやサーブレットコンテキストなどがあるかどうかに関係なく、Tomcat サービスに到達するすべてのリクエストをインターセプトする Tomcat バルブ (現在は 7.0.55 を使用) を実装しようとしています。
invoke
バルブのメソッドは次のようになります。
ローカルでテストしている開発システムでは、すべてが例外として機能しています。「localhost」Tomcat の任意の URI パスへのリクエストは、そのログ行を書き込みます。ではsever.xml
、バルブはHost
要素の外側に設定されています。
私のシステムの hosts ファイルで、ドメインtest.domain.com
が 127.0.0.1 にマップされ、 という名前のコンテキストが 1 つデプロイされているとしsome-webapp
ます。
http://localhost:8080/some-webapp/
上で述べたように、ログ行は を呼び出すとprintet を取得しますhttp://localhost:8080/non-existing-webapp/
。
同じことがドメイン (server.xml で構成されていない) test.domain.com にも当てはまるためhttp://test.domain.com/some-webapp/
、ログ行とhttp://test.domain.com/non-existing-webapp
.
しかし、これは私たちがテストしているサーバーには当てはまりません。ここで、Valve は、URI のコンテキスト名が tomcat に「既知」である場合にのみ呼び出されます。つまり、.../some-webapp/ への呼び出しはログ行を出力し、.../non-existing-webapp への呼び出しはログ行を出力します。 / は単に何もしません - バルブはまったく呼び出されません。
それでも、Tomcat は、この場合クライアントに送信される 404 に応答ヘッダーとして「Apache-Coyote something」が含まれているため、その要求を処理します。
これをさらにデバッグする方法、特にTomcatによるパイプラインの「選択」などのプロセスについてのアイデアがありません-何か考えはありますか?
ありがとう!
java - Where can I find the Apache httpd server IP from within a Tomcat Valve, when AJP was used?
I am working on updating a Tomcat Valve. I want to add a check to see if the caller is coming from localhost/127.0.0.1, which is the case if Apache httpd acts as the frontend webserver on the same machine. So I added a check for the IP address request.getRemoteAddr(). Unfortunately, this method returns the IP address of the client, not of Apache httpd. The current example code can be found here.
I have been searching through the request objects org.apache.coyote.Request and org.apache.catalina.connector.Request, but could not find any method or Object which would return info about the original AJP call.
So my question is: is it possible to get the IP address of the server who does the AJP call?
regex - tomcat 8 の URL の書き換え
2 つの異なるコンテキストでデプロイされた 2 つの tomcat アプリケーションがあります。
次の形式で URL をインターセプトする必要があります。
それらをURLにリダイレクトします:
ここで、「クライアント名」は動的です
tomcats server.xml ファイルの要素で書き換えバルブを使用しようとしましたが、コンテキストを含む URL に対してのみ機能します。すなわち:
に書き換えられる
次の正規表現を使用します。
コンテキストが考慮されないように URL をグローバルに書き換える方法はありますか?
apache - Tomcat の Rewrite Valve の使用
Tomcat の書き換えバルブを使用して、実際の WebApp 名が表示されないように URL を書き換えようとしています。
現在の URL はhttp://example.com/Thingstuffのようになっています。URL が Thingsstuff アプリを指すようにしたいのですが、ユーザーにはhttp://example.com/DifferentStuffを見てもらいたいと思います。
私はまだGoogleでわかりやすい解決策を見つけていないので、ここで得られる助けに感謝します.
ありがとう、ブランドン