On Wed, Jun 3, 2015 at 2:17 PM, Sachin Shetty <[email protected]> wrote:
> Hi,
>
> I am trying to write some throttles that would limit concurrent connections
> for Range requests + specific urls. For example I want to allow only 2
> concurrent range requests downloading a file
> /public-api/v1/fs-content-download
>
> I have a working rule:
>
> stick-table type string size 1M expire 10m store conn_cur
> tcp-request inspect-delay 5s
> acl is_range hdr_sub(Range) bytes=
> acl is_path_throttled path_beg /public-api/v1/fs-content-download
> tcp-request content track-sc1 base32 if is_range is_path_throttled
> http-request deny if { sc1_conn_cur gt 2 } is_range is_path_throttled
>
> Just wanted to see if there is a better way of doing this? Is this efficient
> enough.
>
> I need to include the query string as well in my tracker, but I could not
> figure that out.
>
> Thanks
> Sachin
>
Hi Sachin,
I would do it like this:
stick-table type string size 1M expire 10m store conn_cur
tcp-request inspect-delay 5s
tcp-request accept if HTTP
acl is_range hdr_sub(Range) bytes=
acl is_path_throttled path_beg /public-api/v1/fs-content-download
http-request set-header X-track %[url]
http-request track-sc1 req.hdr(X-track) if is_range is_path_throttled
http-request deny if { sc1_conn_cur gt 2 } is_range is_path_throttled
There might be some typo, but you get the idea.
Baptiste