Send client to a specific backend if header found in previous reply from server

2015-01-07 Thread Sylvain Faivre

Hello,

This is a followup to my post and Baptiste's answer on 20141120.
Unfortunately, I couldn't get this to work.

I am trying to achieve the following : when a response from the 
application server contains a header named X-test, send the following 
requests from the client IP to another backend. The goal is to send 
clients who abuse the servers to a slower queue.


Here is my current config :

In the frontend:
stick-table type ip size 50k expire 5m store gpc0
tcp-request content track-sc2 src
#use_backend slow if { sc2_get_gpc0 gt 0 }

In the backend:
acl mark_as_CPUusage sc2_inc_gpc0 gt 0
acl unmark_as_CPUusage sc2_clr_gpc0 gt 0
tcp-response content accept if { res.hdr(X-test) -m found } 
mark_as_CPUusage
#tcp-response content accept if ! { res.hdr(X-test) -m found } 
unmark_as_CPUusage



I used capture response header to confirm that the application server 
sends the X-test header for some clients.
By querying the stats through unix socket commands, I get gpc0=0 for 
every client IP, so this doesn't seem to work.


Any idea about what I'm missing ?

Sylvain.




Send client to a specific backend if header found in previous reply from server

2014-11-20 Thread Sylvain Faivre

Hi,

I am trying to achieve the following : when a response from the 
application server contains a header named X-test, send the following 
requests from the client IP to another backend for 5 minutes. The goal 
is to send clients who abuse the servers to a slower queue.


Here is what I got so far :

In the frontend:
stick-table type ip size 100k expire 5m store gpc1
tcp-request content track-sc1 src
use_backend slow if { sc1_get_gpc1 gt 0 }

In the backend:
acl mark_as_high_usage sc1_inc_gpc1 gt 0
??? if res.hdr_cnt(X-test) mark_as_high_usage

Does this look good so far ?
I am wondering what to use in place of the ???, because no action is to 
be taken in the backend, this serves only as a way to use the ACL and 
mark the IP using gpc1 so that the frontend sends its further 
connections to another backend.


Thanks in advance.

Sylvain Faivre.