2013年9月30日月曜日

Tomcat + ReverseProxy のときに REMOTE_ADDR が client ip になるようにする Bookmark and Share


Tomcat の手前に ReverseProxy を置いた時に、REMOTE_ADDR を proxy ではなく client ip にするための設定です。

まんまこちらの通りなんですが、
http://frmmpgit.blog.fc2.com/blog-entry-145.html

conf/server.xml
        <valve classname="org.apache.catalina.valves.RemoteIpValve">
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <valve classname="org.apache.catalina.valves.AccessLogValve" directory="logs"
            pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." requestAttributesEnabled="true"
            suffix=".txt">
        </valve>
  • RemoteIpValve を追加
  • AccessLogValve に requestAttributesEnabled="true" を追加

0 件のコメント: