Re: valve execution order

2020-03-27 Thread Mark Thomas
On 23/03/2020 14:23, Jonathan Yom-Tov wrote:
> What about valves which are added programmatically within the same engine?
> Is it possible to control the order?

Not directly. Valves added programmatically are added to the end of the
Pipeline. There isn't an insertValve() method so you need to add them in
the order you want them to be used.

> On Mon, Mar 23, 2020 at 4:14 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
> Mark,
> 
> On 3/23/20 09:59, Mark Thomas wrote:
>>>> On 23/03/2020 13:13, Jonathan Yom-Tov wrote:
>>>>> I'm trying to create a valve which will prevent another valve
>>>>> from working in case a particular request is made. Is there a way
>>>>> to control the valve execution order so that I can inject my
>>>>> valve right before the valve I want to stop?
>>>>
>>>> Valves should be added (and hence executed) in the order they
>>>> appear in the XML.
>>>>
>>>> Also, Valves on an Engine always execute before those on a Host
>>>> which always execute before those on a Context.
> 
> Correct me if I'm wrong, but there is one more caveat: if the
>  defines its own Authenticator, then whatever Authenticator
> Tomcat would have also automatically added is in fact NOT added.
> 
> Where does the context's authentication valve go in that situation? In
> the position where the default one would have gone, or in the
> 's position according to the XML?

As per the order of Valves nested in the Context element.

Mark

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



Re: valve execution order

2020-03-23 Thread Jonathan Yom-Tov
What about valves which are added programmatically within the same engine?
Is it possible to control the order?




On Mon, Mar 23, 2020 at 4:14 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Mark,
>
> On 3/23/20 09:59, Mark Thomas wrote:
> > On 23/03/2020 13:13, Jonathan Yom-Tov wrote:
> >> I'm trying to create a valve which will prevent another valve
> >> from working in case a particular request is made. Is there a way
> >> to control the valve execution order so that I can inject my
> >> valve right before the valve I want to stop?
> >
> > Valves should be added (and hence executed) in the order they
> > appear in the XML.
> >
> > Also, Valves on an Engine always execute before those on a Host
> > which always execute before those on a Context.
>
> Correct me if I'm wrong, but there is one more caveat: if the
>  defines its own Authenticator, then whatever Authenticator
> Tomcat would have also automatically added is in fact NOT added.
>
> Where does the context's authentication valve go in that situation? In
> the position where the default one would have gone, or in the
> 's position according to the XML?
>
> - -chris
>
> -BEGIN PGP SIGNATURE-
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl54xE0ACgkQHPApP6U8
> pFiVHg/+NslxaBe+HThPGSoKS4+VLoHJ/T9ph9ksSDB7YrCBNs6D3NAjwtodmQ4m
> bNF1YmCrm40fcOSe5e4LH74GOFEUKK8VAQ0O0ZVPVljt/RuttmtgCQMHbKEk3FVx
> vPGe9ED6ouNvOjpib6LIoYlQHk1gJcK9joEMHfB4NTT9VM9/QFbgscC1LIeBmk5i
> 4xzsZ1JAajWWJ7mj6kkkyJuUi8CKeeZL+U9kEqDyObTj0ODFpSekv5xmZ3Qoklds
> YmYM00VaMn6R3pZpodk5Ha3/+uzUavEoGJ05Sz6/YIyDedZChAqsvkyAM/klpmYl
> Rd1yiYOqi8zVdndpsrnMoCI5TCmTNuLrUZ44jP1e9kiaZe6bN7+FHyAD0O0SQXaS
> XYvQIgb31MrVX4Q+zFoSHjbHfAaITGER/08X3hj1sOeFQc2i0E6IWLltfuXwG4tW
> jMv/xcCWnkBBylU/grRNF/91Ym4QyZtbUhFKkb64Jrs6Hy24aG9j06rqTI7bxqnL
> hMs5q0bjM6XbmuGoYnS60CKQBL3kwsfyJvbbB5n1X5vyg8LkE/6uYMp67/kIS+M2
> x9uk2ESfOgVj5yZYjxs/pZcWIjU1VdnTVN9vp16RTlR2vwoGCTQ6IouKYaYEiM3u
> l83uObuBW8VcX+QEChSZn8rgSZKLG9xkQr+otFc/oVBPFtW0tJA=
> =t6Nj
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: valve execution order

2020-03-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 3/23/20 09:59, Mark Thomas wrote:
> On 23/03/2020 13:13, Jonathan Yom-Tov wrote:
>> I'm trying to create a valve which will prevent another valve
>> from working in case a particular request is made. Is there a way
>> to control the valve execution order so that I can inject my
>> valve right before the valve I want to stop?
>
> Valves should be added (and hence executed) in the order they
> appear in the XML.
>
> Also, Valves on an Engine always execute before those on a Host
> which always execute before those on a Context.

Correct me if I'm wrong, but there is one more caveat: if the
 defines its own Authenticator, then whatever Authenticator
Tomcat would have also automatically added is in fact NOT added.

Where does the context's authentication valve go in that situation? In
the position where the default one would have gone, or in the
's position according to the XML?

- -chris

-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl54xE0ACgkQHPApP6U8
pFiVHg/+NslxaBe+HThPGSoKS4+VLoHJ/T9ph9ksSDB7YrCBNs6D3NAjwtodmQ4m
bNF1YmCrm40fcOSe5e4LH74GOFEUKK8VAQ0O0ZVPVljt/RuttmtgCQMHbKEk3FVx
vPGe9ED6ouNvOjpib6LIoYlQHk1gJcK9joEMHfB4NTT9VM9/QFbgscC1LIeBmk5i
4xzsZ1JAajWWJ7mj6kkkyJuUi8CKeeZL+U9kEqDyObTj0ODFpSekv5xmZ3Qoklds
YmYM00VaMn6R3pZpodk5Ha3/+uzUavEoGJ05Sz6/YIyDedZChAqsvkyAM/klpmYl
Rd1yiYOqi8zVdndpsrnMoCI5TCmTNuLrUZ44jP1e9kiaZe6bN7+FHyAD0O0SQXaS
XYvQIgb31MrVX4Q+zFoSHjbHfAaITGER/08X3hj1sOeFQc2i0E6IWLltfuXwG4tW
jMv/xcCWnkBBylU/grRNF/91Ym4QyZtbUhFKkb64Jrs6Hy24aG9j06rqTI7bxqnL
hMs5q0bjM6XbmuGoYnS60CKQBL3kwsfyJvbbB5n1X5vyg8LkE/6uYMp67/kIS+M2
x9uk2ESfOgVj5yZYjxs/pZcWIjU1VdnTVN9vp16RTlR2vwoGCTQ6IouKYaYEiM3u
l83uObuBW8VcX+QEChSZn8rgSZKLG9xkQr+otFc/oVBPFtW0tJA=
=t6Nj
-END PGP SIGNATURE-

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



Re: valve execution order

2020-03-23 Thread Mark Thomas
On 23/03/2020 13:13, Jonathan Yom-Tov wrote:
> I'm trying to create a valve which will prevent another valve from working
> in case a particular request is made. Is there a way to control the valve
> execution order so that I can inject my valve right before the valve I want
> to stop?

Valves should be added (and hence executed) in the order they appear in
the XML.

Also, Valves on an Engine always execute before those on a Host which
always execute before those on a Context.

Mark

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



valve execution order

2020-03-23 Thread Jonathan Yom-Tov
I'm trying to create a valve which will prevent another valve from working
in case a particular request is made. Is there a way to control the valve
execution order so that I can inject my valve right before the valve I want
to stop?


Re: RemoveIpValve and valve execution order

2011-11-22 Thread rswart

Thanks for the quick reply. Works like a charm!



Konstantin Kolinko wrote:
 
 2011/11/22 rswart rjsw...@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;%rquot; %s %b
 %{klm_tracking_id}c %S %D /

 
 Best regards,
 Konstantin Kolinko
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RemoveIpValve and valve execution order

2011-11-21 Thread rswart


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;%rquot; %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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: RemoveIpValve and valve execution order

2011-11-21 Thread Konstantin Kolinko
2011/11/22 rswart rjsw...@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;%rquot; %s %b
 %{klm_tracking_id}c %S %D /


Best regards,
Konstantin Kolinko

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