[squid-users] Different routes for domains in dstdomains list

Alex Rousskov rousskov at measurement-factory.com
Wed Sep 21 03:58:34 UTC 2022


On 9/20/22 23:22, Marcelo wrote:

> I am trying to implement a rule in squid.conf, but I cant find enough 
> examples on google to do it.
> 
> Rule:
> 
> User try to access an URL THAT IS IN a dstdomain list so he will be 
> routed to route X
> 
> User try to access an URL THAT IS NOT IN the same dstdomain list so he 
> will be routed to route Y
> 
> All examples I can find is always denying or allowing access to the same 
> just one route.

How do you define "route"?

* If you want a request to go out on a connection that uses a particular 
source IP address then use the tcp_outgoing_address directives.

* If you want to direct a request to different cache_peers, then use 
cache_peer_access and related directives.

* If you want to change the request itself (e.g., change its URL or 
target) then see url_rewrite_program and 
https://wiki.squid-cache.org/SquidFaq/ContentAdaptation . In some cases, 
an originserver cache_peer can work for this as well.


> It would be great if I could implement something like an IF argument in 
> squid.conf.
> 
> Like, if url is in the dstdomain list do like this, if not do like that.
> 
> Any ideias?


Many Squid built-in actions can be configured/tuned based on conditions 
(i.e. ACLs). Some actions can be outsourced to helpers and services. 
However, you cannot easily import custom "do this" code directly into 
Squid. Usually, one does not really have to do that though; if you 
detail your needs (i.e. what "do like this" means in your use case), 
then somebody may be able to suggest a specific solution.


HTH,

Alex.


More information about the squid-users mailing list