Re: [squid-users] Squid 2.6 STABLE 6 in reverse-proxy mode with http data content dynamic modification

From: Amos Jeffries <squid3@dont-contact.us>
Date: Sun, 20 Apr 2008 13:55:21 +1200

Sylvain Beaux wrote:
> Hi all,
>
> I'm trying to use squid in reverse-proxy mode with 2 back-end Web
> servers (Web Srv 1 and Web Srv 2),
> a remote user can request those servers with Squid public FQDNs:
>
> internet lan
> user <-------------------> squid <-------------------> Web Server 1
> [squid1-pub-fqdn] [websrv1-priv-fqdn]
>
> <-------------------> Web Server 2
> [squid2-pub-fqdn] [websrv2-priv-fqdn]
>
> I have installed and configured squid successfully to map the public
> FQDN to the private FQDN.
>
> But, after many unsuccessfull google searches, I would like to know if
> it's possible to dynamically modify the HTML content of the HTTP response.
>
> example 1:
> 1) the user sends a GET request to the Squid1 public FQDN :
> HTTP 1.1 GET /
>
> 2) Squid forwards this request to the WebSrv1
>

Squid does this for reverse-proxies already.

> 3) the WEB Srv 1 sends a HTML page to Squid :
> HTTP 1.1 200 OK
> <html>
> <body>
> <a href=***WebSrv2-priv-fqdn***>
> </body>
> </html>

This is not a well-designed website. URL within a page should be
relative to the pages location or domain. A lot of dynamic systems are
coming to grief these days over hard-coding domain into URI systems
where they are not needed.

> 4) Squid parse the HTML data to modify
> HTTP 1.1 200 OK
> <html>
> <body>
> <a href=***WebSrv2-priv-fqdn***>
> </body>
> </html>
>
> into
>
> HTTP 1.1 200 OK
> <html>
> <body>
> <a href=***Squid2-pub-fqdn***>
> </body>
> </html>
>
> and forwards the modified page to the user.

This is not possible in Squid-2 without patching.
Squid-3 has ICAP and ESI (soon to be eCAP) for modifying content.
Although for simply changing the domain your pages should ideally only
reference '/path-in-site-to-file' etc.

>
> example 2:
> 1) idem
> 2) idem
> 3) the WEB Srv 1 sends a HTTP redirection to the Web Srv 2:
> HTTP 1.1 302 move Temporally
> Location : ***WebSrv2-priv-fqdn***
>
> 4) Squid modify the location header
> Location : ***WebSrv2-priv-fqdn*** into
> Location : ***Squid2-pub-fqdn***
> and forwards the modified redirection to the user.
>

I believe squid does this for properly configured accelerators.
Do you have all the reverse-proxy http_port options and cache_peer
config or just a redirector?

> Is it a Squid possible feature ?
> If not, is it possible to dev (Existant API ? ) a module that can parse
> the http responses and dynamically modify theirs content ?

Lookup Squid-3 ICAP and upcoming eCAP.

Amos

-- 
Please use Squid 2.6.STABLE19 or 3.0.STABLE4
Received on Tue Apr 22 2008 - 12:41:34 MDT

This archive was generated by hypermail 2.2.0 : Thu May 01 2008 - 12:00:04 MDT