library/roles/tomcat-multiple-instances/templates/tomcat-server.xml.j2, library/roles/tomcat/templates/tomcat-server.xml.j2: Support the x-forwarded-for header in the access_log configuration.

This commit is contained in:
Andrea Dell'Amico 2016-03-18 18:18:49 +01:00
parent 0065b6a1b0
commit 3c615980ef
2 changed files with 10 additions and 4 deletions

View File

@ -94,12 +94,15 @@
> >
{% if item.access_log_enabled %} {% if item.access_log_enabled %}
<!-- Automatically substitutes the IP with the one contained
in the x-forwarded-for header if that header is set -->
<Valve className="org.apache.catalina.valves.RemoteIpValve" />
<!-- Access log processes all example. <!-- Access log processes all example.
Documentation at: /docs/config/valve.html Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" --> Note: The pattern used is equivalent to using pattern="combined" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access." suffix="log" prefix="localhost_access." suffix="log"
pattern="%h %l %u %t &quot;%r&quot; %s %b" pattern="combined"
rotatable="False" rotatable="False"
/> />
{% endif %} {% endif %}

View File

@ -139,12 +139,15 @@
--> -->
{% if tomcat_access_log_enabled %} {% if tomcat_access_log_enabled %}
<!-- Automatically substitutes the IP with the one contained
in the x-forwarded-for header if that header is set -->
<Valve className="org.apache.catalina.valves.RemoteIpValve" />
<!-- Access log processes all example. <!-- Access log processes all example.
Documentation at: /docs/config/valve.html Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" --> Note: The pattern used is equivalent to using pattern="combined" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access." suffix="log" prefix="localhost_access." suffix="log"
pattern="%h %l %u %t &quot;%r&quot; %s %b" pattern="combined"
rotatable="False" rotatable="False"
/> />
{% endif %} {% endif %}