Because the company's dns supports China Telecom Netcom's traffic distribution, a project uses this function to allow users to access the same link. The China Telecom ip Address can see one page and the China Netcom ip Address can see another one. The original configuration is to use the hosts of squid. The squid of China Netcom refers to the backend of the China Netcom page, and the squid of China Telecom refers to the backend of the China Telecom page. This practice has obvious disadvantages: 1. Life and death
Because the company's dns supports China Telecom Netcom's traffic distribution, a project uses this function to allow users to access the same link. The China Telecom ip Address can see one page and the China Netcom ip Address can see another one.
The original configuration is to use squIdHosts, Netcom's squid refers to the Netcom page background, and Telecom's squid refers to the telecom page background.
This practice has obvious disadvantages:
1. There must be two backend servers. Currently, different ports cannot be configured in squid2.5.
2. squid's hosts must have two copies, which is not conducive to management. If the front end is constantly expanded, this is another annoyance.
If the cache of this domain name China Netcom Telecom is directed to the middle-layer proxy, these problems are easily solved.
The configuration logic is not complex:
1. First, obtain the Client ip address. On the middle-layer proxy, the Client ip address is the Intranet ip address of the previous cache server, which is easy to differentiate.
2. Use a judgment statement to let them go all the way.
Configuration:
LoCatIon = /{
Proxy_pass http: // proDuCt.xxx.com;
INcLude proxy. conf;
If ($ remote_aDdR ~ ^ 192.168.1 ){
ReWrite^/$/A/last;
}
If ($ remote_addr ~ ^ 192.168.2 ){
Rewrite ^/$/B/last;
}
}
However, if there is no front-end cache, it is still impossible to make such a distinction.