rewriting URL in 301/302 response

From: Kazuto Tominaga <tominaga@dont-contact.us>
Date: Fri, 09 Jan 1998 01:24:55 +0900

Hi,

Is it possible for squid to rewrite URL at the "Location:" field in
"301 Moved Permanently" or "302 Moved Temporarily" response from web
servers?

My site has firewall, and I am using squid as an accelerator at the
border of my site. Squid receives requests from clients outside,
and forwards them to web servers inside the site. Because there are
several web servers inside, I use a redirector to demultiplex
requests by rewriting URL like this:

  http://www.squid.my.site/xlab/ -> http://www.xlab.my.site/
  http://www.squid.my.site/ylab/ -> http://www.ylab.my.site/

A problem occurs when a web server inside the site returns "301
Moved Permanently" code. For example, accessing squid by URL

  http://www.squid.my.site/xlab/foo

then the redirector rewrites it into

  http://www.xlab.my.site/foo

and the web server (www.xlab.my.site) returns

  301 Moved Permanently
  Localtion: http://www.xlab.my.site/foo/

then squid returns this message to the web client. The client will
try to access the page with URL

  http://www.xlab.my.site/foo/

but the machine www.xlab.my.site is inside the firewall, so the page
cannot be accessed from outside the site with this URL.

So I thought it will go well if squid has facility to rewrite URL at
Location: field, say rewriting the URL

  Location: http://www.xlab.my.site/foo/

back to

  Location: http://www.squid.my.site/xlab/foo/

by a (reverse) redirector or anything.

So questions:

 1. Does squid has this facility? Then how can I use it?
 2. Or is there any other good way to avoid this problem?

Thanks in advance.

Regards,

 -- Kazuto Tominaga (tominaga@cc.teu.ac.jp)
Received on Thu Jan 08 1998 - 08:26:57 MST

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