LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Squid multiple ports multiple destinations (http://www.linuxquestions.org/questions/linux-server-73/squid-multiple-ports-multiple-destinations-4175450243/)

pestka 02-15-2013 04:49 AM

Squid multiple ports multiple destinations
 
Hello there,

I want to spawn one squid instance on multiple ports (which I already have).

Code:

http_port myip:9000 name=first
http_port myip:9001 name=second
http_port myip:9002 name=third

Now what I want to achieve is that when I connect to different ports I will go through different proxies, like this:
- port 9000 I go through proxy0
- port 9001 I go through proxy1
- port 9001 I go through proxy2

This is what's my conf now;
Code:

acl exceptions dstdomain "/etc/squid/squid-exception.acl"
always_direct allow exceptions
http_access allow all

cache_peer proxy0 parent port0 0 no-query name=first
cache_peer proxy1 parent port1 0 no-query name=second
cache_peer proxy2 parent port2 0 no-query name=third

but even though I'm connected to my proxy to port1 it does not go through proxy1:port1 bur proxy0:port0 - always.

How to tell squid to use a certain cache_peer based upon which port I am connecting to?

pestka 02-15-2013 05:53 AM

I've figured it out by myself :)

For any other people who struggle with that too, here's how to do that:

Code:

acl PORTNAME myport 9000
cache_peer MYPROXY parent PORT_OF_PROXY 0 no-query LOGIN PASS
cache_peer_access MYPROXY deny !PORTNAME

where myproxy is the second proxy (and its port further on). Then we deny access to all request EXCEPT OF the port one has specified.


All times are GMT -5. The time now is 10:19 PM.