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

From: ying lcs <yinglcs@dont-contact.us>
Date: Wed, 31 Oct 2007 11:33:47 -0500

Dmitry,

Thank you for your help. But after I added this in my squid conf.
Squid stops working.
When I hit my browser via Squid to get content, nothing returns. No
even non 'text/plain' content. Can you please tell me what am i
missing?

Thank you.

# TAG: http_reply_access
# Allow replies to client requests. This is complementary to http_access.
#
# http_reply_access allow|deny [!] aclname ...
#
# NOTE: if there are no access lines present, the default is to allow
# all replies
#
# If none of the access lines cause a match the opposite of the
# last line will apply. Thus it is good practice to end the rules
# with an "allow all" or "deny all" entry.
#
#Default:

#http_reply_access allow all

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

http_reply_access allow all

On 10/30/07, Dmitry S. Makovey <dmitry@athabascau.ca> wrote:
> 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 Wed Oct 31 2007 - 10:33:52 MDT

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