A
A
Alexander2016-01-30 15:38:01
linux
Alexander, 2016-01-30 15:38:01

How to make access by hosts in squid?

Hello everyone, I came across a problem here. There is a site.ru domain. And a bunch of subdomains assigned to the server (actually * CNAME site.ru). It is necessary that when accessing sub1.site.ru a person receives ip1, with sub2 - ip2, etc.
Those. something like this:

http_port ip2.site.ru:8085 name=nip2 
http_port ip3.site.ru:8085 name=nip3

acl ip2 myip ip2.site.ru
acl ip3 myip ip3.site.ru

tcp_outgoing_address <ip2> ip2 
tcp_outgoing_address <ip3> ip3 
tcp_outgoing_address <default ip>

But the problem is that it takes the first rule from ip2 and applies it. Apparently because it resolves the host to the ip address (and it is the same for all subdomains).
If you do it at the port level, then everything works:
http_port 8085 name=port2 
http_port 8086 name=port3

acl ip2 myportname port2 
acl ip3 myportname port3 

tcp_outgoing_address <ip2> ip2 
tcp_outgoing_address <ip3> ip3 
tcp_outgoing_address <default ip>

But access on various domains is necessary for me. Are there options to solve my problem? Maybe someone came across.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gilgameshfreedom, 2016-01-30
@gilgameshfreedom

It is necessary that when accessing sub1.site.ru a person receives ip1, with sub2 - ip2, etc.
This is decided at the level of your DNS server. Make separate A-records for each of the sub*s and you're done.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question