H2Databaseを追っかけていたりしたブログ

H2 database のリリースノートを読んだりとか。

ロードバランサーとTomcat

ロードバランサーで外側だけhttpsにしていて、Servlet相対パスでリダイレクトさせていたので、リダイレクト先がhttpになる事象発生。まぁ、Tomcatは外からhttpsで来てるっての分からないしなぁ。

基本外からは全てhttpsなので、一旦httpに振られても、ロードバランサーでさらにhttpsにリダイレクトしてくれる(設定を入れてもらっていた)ので、ブラウザの設定さえ変えてしまえば問題ない(人としてダメな態度)かなと思ったものの。

調べたら、あっさり解決。

この問題を回避するにはserver.xmlのconnectorタグの属性を変更すれば回避できます。
proxyName="サーバ名"
proxyPort="ポート番号" ※通常SSLなら443
scheme="スキーマ" ※通常SSLならhttps
secure="true" これは設定しなくてもよいけど、request.isSecure()の戻り値がtrueになる。

http://guns.at.webry.info/200804/article_1.html

そういや以前この属性みたことあったけど、何となくよくわからないまま、うーん?とスルーしてた。

日々学ぶことは多いです。忘れることはもっと多いのはいうまでもなく。

追記。本家のドキュメントでは、こんな感じ。

ProxyName
If this Connector is being used in a proxy configuration, configure this attribute to specify the server name to be returned for calls to request.getServerName(). See Proxy Support for more information.

ProxyPort
If this Connector is being used in a proxy configuration, configure this attribute to specify the server port to be returned for calls to request.getServerPort(). See Proxy Support for more information.

schema
Set this attribute to the name of the protocol you wish to have returned by calls to request.getScheme(). For example, you would set this attribute to "https" for an SSL Connector. The default value is "http". See SSL Support for more information.

secure
Set this attribute to true if you wish to have calls to request.isSecure() to return true for requests received by this Connector (you would want this on an SSL Connector). The default value is false.

http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html

また、次のページがそのものずばり。

http://tomcat.apache.org/tomcat-6.0-doc/proxy-howto.html