I have a Squid server hosted on DigitalOcean with a subdomain wildcard so every subdomain gets redirected to my server.

In my Squid config I have those 2 lines

cache_peer proxydomain.tld parent 20000 0 no-query no-digest
never_direct allow all

to redirect all the traffic to another proxy server, which works perfectly.

Now I want to redirect different subdomains to different proxy domains, so if you would use first.mysquidserver.com it redirects you to proxydomain.tld, if you use second.mysquidserver.com it redirects you to anotherproxydomain.tld

I do not want to use different proxies depending on the site which got requested, I want to use different proxies depending on what subdomain gets used with my Squid server!

I didn't get any smarter with the documentation and Google. Not sure if this is possible with Squid? If not, would this work with something like NGINX? I know I could just redirect the subdomain to a different server, but that's not a good solution

Hopefully, it's clear what I want to say, thanks for your help.

1 Answer 1


If You do not need specific feature of squid I would opt for a web-server like apache httpd (or even nginx, but not me...) as the configuration is more well-known and simple.
But it is of course possible with squid.

I assume You havce a recent (v4) installed.
Configured the http_port as accel.
Set up the different cache-peers (as origin servers or upstream proxy, depending on what they are).
Create ACLs for the dstdomains (one ACL for each cache_peer or cache_peer group).
Configure routing with cache_peer_access (define based on ACLs which ceche_peers are used for requests).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.