Search squid archive

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux