[squid-users] transparent redirect and http 302 redirects

From: Ethan Miller <thnntn_at_gmail.com>
Date: Thu, 6 May 2010 22:48:13 -0700

Hi there -

I have a somewhat unusual project that's structured similar to the

In my case, we're looking for text patterns in html pages, then
replacing some text, saving the modified text locally (the same
machine runs squid and nginx), and then issuing the redirect for that
modified file.

This basically works - but there is some strange behavior on google
pages. Some images are broken and then clicking on a result gets you
another broken page, while a google URL remains in the address bar.

I have a simpler example that I think illustrates the issue: I use a
little custom php script for quicklinks that I can add as a search
engine in FIrefox. It just takes a string like "g yreka" and issues a
302 redirect to a google search for yreka.

Note that "yreka" is a string of interest for the squid redirector
program. This doesn't happen with other strings that the redirector
does not act upon. (That said, the redirector script isn't looking at
the text in the URL, it's grabbing the page that was requested, and
searching for the text there.)

Without using the proxy, the request/response headers look like this:

GET /?unicmd=g+yreka HTTP/1.1
<etc ...>

HTTP/1.1 302 Found
Date: Tue, 13 Apr 2010 05:15:43 GMT
Server: Apache
X-Powered-By: PHP/5.2.11
Location: http://www.google.com/search?q=yreka
<etc ...>

When running through the proxy, it looks like this:

GET /?unicmd=g+yreka HTTP/1.1
<etc ...>

HTTP/1.0 200 OK
Server: nginx/0.7.62
Date: Tue, 13 Apr 2010 05:21:10 GMT
Content-Type: text/html
Content-Length: 17865
Last-Modified: Tue, 13 Apr 2010 05:21:10 GMT
Accept-Ranges: bytes
X-Cache: MISS from jefferson
X-Cache-Lookup: HIT from jefferson:3128
Via: 1.1 jefferson:3128 (squid/2.7.STABLE6)
Connection: keep-alive
Proxy-Connection: keep-alive

In my browser, I still see the ?unicmd=g+yreka URL - but the page is
the modified google results page.

Hope the question is clear, apologies for the long first message. If
you're wondering why I would be doing such a thing, the project is
described here:

- Ethan Miller
Received on Fri May 07 2010 - 05:48:21 MDT

This archive was generated by hypermail 2.2.0 : Fri May 07 2010 - 12:00:03 MDT