Re: [squid-users] Configure squid based on content type of http response

From: Dmitry S. Makovey <dmitry@dont-contact.us>
Date: Tue, 30 Oct 2007 15:21:31 -0600

On October 30, 2007, ying lcs wrote:
> Hi,
>
> Can you please tell me if it is possible to configure squid based on
> content type of http response?
>
> For example, I want to configure squid so that if it sees a
> Content-type== text/plain, it always return a local file called
> 'dummy.txt'?
>
> Can I do that in squid? or other http proxy?
>
> Thank you.

/etc/squid/squid.conf:
...
acl plain_content rep_mime_type -i text/plain
# http_reply_access allow GET_method xml_content from_clients
redirect_program /usr/local/bin/myscript
redirector_access plain_content
...

/usr/local/bin/myscript:
#!/bin/perl

while($s=<>){
 print "http://foo.bar/dummy.txt"
}

Something like that. Not sure If this has no mistakes but should give you
enough ideas on how to attack this one.

-- 
Dmitry Makovey
Web Systems Administrator
Athabasca University
(780) 675-6245

Received on Tue Oct 30 2007 - 15:21:39 MDT

This archive was generated by hypermail pre-2.1.9 : Thu Nov 01 2007 - 13:00:02 MDT