[squid-users] Possible to user reply_header_add directive with acl random access list ?

Alex Rousskov rousskov at measurement-factory.com
Wed Jul 17 13:05:43 UTC 2019


On 7/17/19 7:55 AM, --Ahmad-- wrote:

> indeed i read about reply header ACL That :

> all ACLs in
> the ACL list must be satisfied for the insertion to happen.

Amos is right, but the documentation you quote has nothing to do with
the fact that each reply_header_add rule is checked. That arguably
non-obvious behavior should be documented IMO. Quality pull requests
that enhance Squid documentation are welcomed on GitHub[1].


> what do i need to let the output single value and not
> multiple values

You are pushing against ACL limits, but it _is_ possible to restrict
further reply_header_add matches using modern Squid ACLs alone:

  acl markProcessed annotate_client processed=yes
  acl markedProcessed note processed yes

  acl p1in10 random 1/10
  acl p1in9  random 1/9
  ...

  reply_header_add Start "A" !markedProcessed p1in10 markProcessed
  reply_header_add Start "B" !markedProcessed p1in9  markProcessed
  ...

If you have a large number of possible Start values, then adding a Start
header using an eCAP adapter may be faster than checking so many ACLs. I
do not know what "large" means here, but I would not worry if you have
fewer than 100 values.


N.B. Please do not misinterpret my responses as an implication that what
you are doing overall is a good idea, or that there are no better ways
to accomplish the same goal. I am just answering specific questions in
case those answers would be useful for other use cases.


Cheers,

Alex.
[1] https://wiki.squid-cache.org/MergeProcedure


More information about the squid-users mailing list