[squid-users] Squid Reverse Proxy - how to rewrite returning HTML code

From: <koen.vdvelde@dont-contact.us>
Date: Wed, 15 Feb 2006 14:01:11 +0100

Hi All,

I'm trying to configure Squid (squid-2.5.STABLE3-3.3E) as a Reverse Proxy /
HTTP Accelerator

This is the setup :
- 1 server "SQUID", running squid,
   accepts the http-requests from the internet
  (this one should be placed In the DMZ)

  == SQUID == (http://web-site.server.com:80)

- an other server "APACHE", running apache, in the LAN,
  accepts request from local clients,
  and redirected requests from the squid server

  == APACHE == (http://site.server.com:80)

My squid.conf looks like this :
< redirect_program /usr/local/bin/SquidRedirect.pl
< redirect_children 5
< redirect_rewrites_host_header on
< httpd_accel_host virtual
< httpd_accel_port 80
< httpd_accel_single_host off
< httpd_accel_with_proxy off
< httpd_accel_uses_host_header on

This is the SquidRedirect.pl :
< $|=1;
< while (<>) {
< s@http://web-site.server.com@http://site.server.com@;
< print;
< }

Everything works fine :
- a client requests http://web-site.server.com at the SQUID-server
- the SQUID redirects the request to APACHE as : http://site.server.com
- the Apache returns its index.html page
- the Squid gives this page to the client
- the client displays http://web-site.server.com/index.html

This works ... as long as the HTTP-code returned by apache is using
relative links
BUT ... when absolute links (including servername, ...) are returned, the
client is pointed to the URL http://site.server.com/... . And this
DNS-name (site.server.com) is only known in the LAN, not on the
internet-client :-(

Since I do not own the APACHE-server myself, I can't change it's behaviour
and will have to find a way to make it working trough squid.

Can SQUID rewrite the returning HTML code too ? Just like it
rewrites/redirects the http-requests ?

Or is there an other solution to get the reverse proxy/http-accelerator to
work without the redirect-trouble ?

Thanks in advance for your assistance,
Koen.
Received on Wed Feb 15 2006 - 06:02:48 MST

This archive was generated by hypermail pre-2.1.9 : Wed Mar 01 2006 - 12:00:03 MST