Re: Accelerate many origin servers using the host header [patch]

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 09 Dec 1997 01:29:14 +0100

The 1.1.X series has a somewhat confusing acceleration logic..

1. If httpd_accel virtual, then always use IP of the receiving
interface.
2. If httpd_accel (not virtual), and ..._uses_host_header, then use
Host: header is available
3. If Host: is not available, use the host from httpd_accel.

Step 1 and 2 should probably be reversed, so that the Host: header have
a higer precendence than the virtual IP address.

Patch included.

If you are not accelerating using multiple IP addresses, then you can
use "httpd_accel main.server 80" instead of applying the patch.

If you rewrite the squid servers hosts table with the internal addresses
for your servers, you don't need a redirector program to translate the
incoming addresses when the Host: header is used. only when "httpd_accel
virtual" is used.

---
Henrik Nordström
Peter Sorensen wrote:
> 
> Hi,
> 
> I trying to get squid( 1.1.17) to act as front-end
> for 3 internal www servers. What I did was:
> 
> http_port 80
> httpd_accel virtual 80
> httpd_accel_uses_host_header on
> 
> and define a redirector program to translate incoming
> addresses to point to the correct server.
> 
> The problem is that I don't get the host name whatever I do, but
> only the IP-address. What is wrong?
> 
> Regards
> 
> Peter Sorensen/University of Odense,dk/e-mail:maspsr@dou.ou.dk

1657,1666c1657
< if (vhost_mode) {
< /* Put the local socket IP address as the hostname */
< url_sz = strlen(url) + 32 + Config.appendDomainLen;
< icpState->url = xcalloc(url_sz, 1);
< sprintf(icpState->url, "http://%s:%d%s",
< inet_ntoa(icpState->me.sin_addr),
< (int) Config.Accel.port,
< url);
< debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
< } else if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) {

---
> 	if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) {
1680a1672,1680
> 	} else if (vhost_mode) {
> 	    /* Put the local socket IP address as the hostname */
> 	    url_sz = strlen(url) + 32 + Config.appendDomainLen;
> 	    icpState->url = xcalloc(url_sz, 1);
> 	    sprintf(icpState->url, "http://%s:%d%s",
> 		inet_ntoa(icpState->me.sin_addr),
> 		(int) Config.Accel.port,
> 		url);
> 	    debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
Received on Mon Dec 08 1997 - 16:37:20 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:37:52 MST