Search squid archive

Re: Configure squid based on content type of http response

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

 



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

Attachment: signature.asc
Description: This is a digitally signed message part.


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

  Powered by Linux