You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by rswart <rj...@gmail.com> on 2011/11/22 08:48:57 UTC

RemoveIpValve and valve execution order


Hi,

I'm trying to configure the RemoteIp in combination with AccessLogValve.
request.getRemoteAddr() return the  correct remote-ip from X-Forwarded-For
header, but AccessLogValve still logs the unmodified (proxy) ip-address. Can
this be related to the execution order of valves? Can I enforce the order
somehow?


Version = 7.0.22, valves: 

      <Valve className="org.apache.catalina.valves.RemoteIpValve"
             remoteIpHeader="X-Forwarded-For"
             protocolHeader="X-Forwarded-Proto"/>

       <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
               prefix="${instanceId}_access." suffix=".log"
               pattern="%h %{Host}i %t &quot;%r&quot; %s %b
%{klm_tracking_id}c %S %D" />
 
Richard
-- 
View this message in context: http://old.nabble.com/RemoveIpValve-and-valve-execution-order-tp32872128p32872128.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: RemoveIpValve and valve execution order

Posted by rswart <rj...@gmail.com>.
Thanks for the quick reply. Works like a charm!



Konstantin Kolinko wrote:
> 
> 2011/11/22 rswart <rj...@gmail.com>:
>>
>>
>> Hi,
>>
>> I'm trying to configure the RemoteIp in combination with AccessLogValve.
>> request.getRemoteAddr() return the  correct remote-ip from
>> X-Forwarded-For
>> header, but AccessLogValve still logs the unmodified (proxy) ip-address.
>> Can
>> this be related to the execution order of valves? Can I enforce the order
>> somehow?
> 
> No. It is not related to their order.
> If you need AccessLogValve  to use information from RemoteIpValve you
> have to enable that explicitly. See "requestAttributesEnabled" in the
> documentation.
> 
> http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
> 
>>
>>
>> Version = 7.0.22, valves:
>>
>>      <Valve className="org.apache.catalina.valves.RemoteIpValve"
>>             remoteIpHeader="X-Forwarded-For"
>>             protocolHeader="X-Forwarded-Proto"/>
>>
>>       <Valve className="org.apache.catalina.valves.AccessLogValve"
>> directory="logs"
>>               prefix="${instanceId}_access." suffix=".log"
>>               pattern="%h %{Host}i %t &quot;%r&quot; %s %b
>> %{klm_tracking_id}c %S %D" />
>>
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/RemoveIpValve-and-valve-execution-order-tp32872128p32872144.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: RemoveIpValve and valve execution order

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/11/22 rswart <rj...@gmail.com>:
>
>
> Hi,
>
> I'm trying to configure the RemoteIp in combination with AccessLogValve.
> request.getRemoteAddr() return the  correct remote-ip from X-Forwarded-For
> header, but AccessLogValve still logs the unmodified (proxy) ip-address. Can
> this be related to the execution order of valves? Can I enforce the order
> somehow?

No. It is not related to their order.
If you need AccessLogValve  to use information from RemoteIpValve you
have to enable that explicitly. See "requestAttributesEnabled" in the
documentation.

http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html

>
>
> Version = 7.0.22, valves:
>
>      <Valve className="org.apache.catalina.valves.RemoteIpValve"
>             remoteIpHeader="X-Forwarded-For"
>             protocolHeader="X-Forwarded-Proto"/>
>
>       <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>               prefix="${instanceId}_access." suffix=".log"
>               pattern="%h %{Host}i %t &quot;%r&quot; %s %b
> %{klm_tracking_id}c %S %D" />
>

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org