Search squid archive

Re: Possible to user reply_header_add directive with acl random access list ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/19/19 2:54 PM, --Ahmad-- wrote:

> say i have 10 ips 
> i want random external over them .

> if external was ip1 , then “start header” should be A
> if external was ip2 , then “start header” should be b
> if external was ip3 , then “start header” should be c
> if external was ip4 , then “start header” should be d

I can suggest two options. The first one is a little simpler, but it
uses actual IP addresses (e.g., "1.1.1.1") instead of IP address
labels/pseudonyms (e.g. "A") for Start header values:

  # select one of ten IPs using a uniform random distribution
  tcp_outgoing_address 12.13.200.10 p1in10
  tcp_outgoing_address 12.13.200.11 p1in9
  ...
  tcp_outgoing_address 12.13.200.19 all

  # tell the client what IP our to-server connection originated from
  reply_header_add Start "%<la"


If you do not really want to send the actual IP values in Start headers,
and are not worried that Squid may not actually use the selected
outgoing IP address for some reason, then you can use annotations to
mark specific tcp_outgoing_address decisions:

  acl markDecisionA annotate_client decision=A
  acl markDecisionB annotate_client decision=B
  ...
  acl markDecisionJ annotate_client decision=J

  # select one of ten IPs using a uniform random distribution
  # and remember our decision as a transaction annotation
  tcp_outgoing_address 12.13.200.10 p1in10 markDecisionA
  tcp_outgoing_address 12.13.200.11 p1in9 markDecisionB
  ...
  tcp_outgoing_address 12.13.200.19 markDecisionJ

  # relay our tcp_outgoing_address decision to the client
  reply_header_add Start "%note{decision}"


HTH,

Alex.
_______________________________________________
squid-users mailing list
squid-users@xxxxxxxxxxxxxxxxxxxxx
http://lists.squid-cache.org/listinfo/squid-users




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux