|
Personal tools |
|
|
/Talk:Documentation/Squid
From AnnvixA note on transparent proxies combined with named hostsIf you run a webserver on the same box as the squid proxy then you need to be aware that the proxy will look at the entries in /etc/hosts and possibly do a DNS lookup for the IP address that the proxied request will come from. That request will then be passed on as an http request to the resulting IP. In short that means that if you're doing virtual hosting via named hosts then you are in for a hassle. The requests coming into your http server will ask for the http info for that IP only, thus named hosting goes out the window. Without proxy it looks like: lanhost1 -> annvix.host => (apache) IP+name - /var/www/lanhost1 lanhost2 -> annvix.host => (apache) IP+name - /var/www/lanhost2 lanhost3 -> annvix.host => (apache) IP+name - /var/www/lanhost3 With a proxy it looks like: lanhost1 -> anvix.host => (squid) (apache) IP - /var/www/lanhost1 lanhost2 -> anvix.host => (squid) (apache) IP - /var/www/lanhost1 lanhost3 -> anvix.host => (squid) (apache) IP - /var/www/lanhost1 This is not what I want. You can work around it by doing named hosts with the IP address instead and giving each hosted site it's own IP, probably on the same box that all point to the same server. In my situation, I run three different sites to be available to my internal LAN. Each host has a different name so when I go to http://lanhost1 I expect to see a different site than when I go to http://lanhost2 or http://lanhost3. All this worked fine until I began using Squid to transparently proxy my requests, then every request brought up the same site. I changed the configuration of apache so that requests to http://127.0.0.1 are responded to as the contents of what was previously http://lanhost1 then added http://127.0.0.2 as what was previously http://lanhost2 and finally http://127.0.0.3 as the contents of what was previously http://lanhost3. I defined those hosts in /etc/hosts with their friendly names like: 127.0.0.1 localhost annvix.locallan localhost1 127.0.0.2 localhost2 127.0.0.3 localhost3 Finally I restarted squid (so it would know to use the new information) and restarted apache (so it would use the new naming system) and then was able to get to the hosts I expected at their friendly addresses. The end result looks like: lanhost1 -> anvix.host => (squid) (apache) IP1 - /var/www/lanhost1 lanhost2 -> anvix.host => (squid) (apache) IP2 - /var/www/lanhost2 lanhost3 -> anvix.host => (squid) (apache) IP3 - /var/www/lanhost3 Much better. Ancientt 21:59, 3 March 2007 (MST) |
![]() |
|
| ||