Re: [squid-users] Squid GET format

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Sat, 22 Apr 2006 01:50:26 +0200

fre 2006-04-21 klockan 08:50 -0700 skrev Sketch:

> because the site uses Host Based Virtual Hosts The problem comes in
> when a 302 code is returned. For example: my site: sketch.com
> returns a 302 with the Location: header of "http://www.sketch.com".
> Squid doesn't handle this properly and tries to redirect to
> "http://www.sketch.comhttp//sketch.com".

Squid does not touch Location headers. They are forwarded to the client
exacly as it was given to Squid by the web server..

> The request looks like:
>
> GET http://sketch.com/ HTTP/1.0
> Host: sketch.com
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1)
> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Cache-Control: max-age=259200
> Proxy-Connection: keep-alive
>
> And the response looks like:
>
> HTTP/1.1 302
> Date: Fri, 21 Apr 2006 15:42:31 GMT
> Server: Apache/1.3.34
> Location: http://www.sketch.comhttp://sketch.com/

Why is your server sending such bad Location headers in response to a
valid request?

> As you can see, the apache server is taking the request "GET
> http://sketch.com/", and the server is taking that literal.

And it should. This was what the client requested..

> Reading documentation shows that the Host: value is put into the URI
> by the httpd_accel_uses_host_header on option, is there any option to
> not have the host value in the URI? So the request from squid would
> look like:
>
> Get /index.html
> Host: sketch.com

Ah, now I get what you are talking about.

According to the HTTP protocol the above two requests are identical when
given to a HTTP server. But it is possible your web server is buggy and
does not handle fully qualified URLs properly. If this is the case then
you need the rproxy patch from devel.squid-cache.org (or wait for
Squid-3.0).

This i not related to the httpd_accel_uses_host_header directive in any
manner, but rather in how the request is forwarded to the backend
server. The fully qualified form is the format expected by proxies (i.e.
peers in Squid speak), the short form is the format expected by web
servers.

Regards
Henrik

Received on Fri Apr 21 2006 - 17:50:39 MDT

This archive was generated by hypermail pre-2.1.9 : Mon May 01 2006 - 12:00:02 MDT