can I remove cache feature from Squid or how can I make the time of cache is very short

View: New views
11 Messages — Rating Filter:   Alert me  

can I remove cache feature from Squid or how can I make the time of cache is very short

by JXu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

Please help me to understand the question described as below:

I added a service in c-icap to block some URLs(for example, www.yahoo.com)  and I did it. It displays permission denied web page (designed by me) when the user enters these URLs.

After I made www.yahoo.com available, it does not display real www.yahoo.com web page. Instead, it  displays permission denied web page when I enter www.yahoo.com. It keeps displaying  permission denied web page until several minutes are passed.  

Is it cache feature from Squid? Can I remove cache feature from Squid or make the time of cache is very short. I hope after I made www.yahoo.com available, I can see real www.yahoo.com web page in short time and I do not want to see permission denied web page for several minutes.

Thank you in advance.
Forrest

Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by Adrian Chadd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Sep 29, 2007, JXu wrote:

>
> Hi
>
> Please help me to understand the question described as below:
>
> I added a service in c-icap to block some URLs(for example, www.yahoo.com)
> and I did it. It displays permission denied web page (designed by me) when
> the user enters these URLs.
>
> After I made www.yahoo.com available, it does not display real www.yahoo.com
> web page. Instead, it  displays permission denied web page when I enter
> www.yahoo.com. It keeps displaying  permission denied web page until several
> minutes are passed.  
>
> Is it cache feature from Squid? Can I remove cache feature from Squid or
> make the time of cache is very short. I hope after I made www.yahoo.com
> available, I can see real www.yahoo.com web page in short time and I do not
> want to see permission denied web page for several minutes.

Which version of Squid are you using?




Adrian


Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by Amos Jeffries-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

JXu wrote:

> Hi
>
> Please help me to understand the question described as below:
>
> I added a service in c-icap to block some URLs(for example, www.yahoo.com)
> and I did it. It displays permission denied web page (designed by me) when
> the user enters these URLs.
>
> After I made www.yahoo.com available, it does not display real www.yahoo.com
> web page. Instead, it  displays permission denied web page when I enter
> www.yahoo.com. It keeps displaying  permission denied web page until several
> minutes are passed.  
>
> Is it cache feature from Squid? Can I remove cache feature from Squid or
> make the time of cache is very short. I hope after I made www.yahoo.com
> available, I can see real www.yahoo.com web page in short time and I do not
> want to see permission denied web page for several minutes.
>
> Thank you in advance.
> Forrest

Have your custom ICAP service set the cache-control headers properly in
the custom page. Expires: with the current time or a few seconds in the
future should do it.

Amos

Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by JXu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Adrian,

Thank you for your reply.

I use Squid 3.0 pre7 and Squid 3.0 pre6

Cheers,
Forrest


Adrian Chadd wrote:
On Sat, Sep 29, 2007, JXu wrote:
>
> Hi
>
> Please help me to understand the question described as below:
>
> I added a service in c-icap to block some URLs(for example, www.yahoo.com)
> and I did it. It displays permission denied web page (designed by me) when
> the user enters these URLs.
>
> After I made www.yahoo.com available, it does not display real www.yahoo.com
> web page. Instead, it  displays permission denied web page when I enter
> www.yahoo.com. It keeps displaying  permission denied web page until several
> minutes are passed.  
>
> Is it cache feature from Squid? Can I remove cache feature from Squid or
> make the time of cache is very short. I hope after I made www.yahoo.com
> available, I can see real www.yahoo.com web page in short time and I do not
> want to see permission denied web page for several minutes.

Which version of Squid are you using?




Adrian

Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by JXu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Amos

Thank you for your reply. I believe this is good solution.
But after I made the change below in my custom web page:

 snprintf(buf, 128, "X-Infection-Found: Type=0; Resolution=2; Threat=URL;");
 buf[127] = '\0';
 ci_request_add_xheader(req, buf);
snprintf(buf, 128, "Cache-Control: cache-request-directive=no-cache;cache-response-directive=no-cache;");
 // i tested snprintf(buf, 128, "Cache-Control: //cache-request-directive='no-cache';cache-response-directive='no-cache';"); also.
      buf[127] = '\0';
      ci_request_add_xheader(req, buf);
         snprintf(buf, 128, "Expires: -1;");
      buf[127] = '\0';
      ci_request_add_xheader(req, buf);

my custom web page is still kept displaying . Any comments?

Thank you.

Forrest


Amos Jeffries-2 wrote:
JXu wrote:
> Hi
>
> Please help me to understand the question described as below:
>
> I added a service in c-icap to block some URLs(for example, www.yahoo.com)
> and I did it. It displays permission denied web page (designed by me) when
> the user enters these URLs.
>
> After I made www.yahoo.com available, it does not display real www.yahoo.com
> web page. Instead, it  displays permission denied web page when I enter
> www.yahoo.com. It keeps displaying  permission denied web page until several
> minutes are passed.  
>
> Is it cache feature from Squid? Can I remove cache feature from Squid or
> make the time of cache is very short. I hope after I made www.yahoo.com
> available, I can see real www.yahoo.com web page in short time and I do not
> want to see permission denied web page for several minutes.
>
> Thank you in advance.
> Forrest

Have your custom ICAP service set the cache-control headers properly in
the custom page. Expires: with the current time or a few seconds in the
future should do it.

Amos

Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by Amos Jeffries-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>
> Hi Amos
>
> Thank you for your reply. I believe this is good solution.
> But after I made the change below in my custom web page:
>
>  snprintf(buf, 128, "X-Infection-Found: Type=0; Resolution=2;
> Threat=URL;");
>  buf[127] = '\0';
>  ci_request_add_xheader(req, buf);
> snprintf(buf, 128, "Cache-Control:
> cache-request-directive=no-cache;cache-response-directive=no-cache;");
>  // i tested snprintf(buf, 128, "Cache-Control:
> //cache-request-directive='no-cache';cache-response-directive='no-cache';");
> also.

Ah, it looks like you are slightly misunderstanding the BNF descriptions
in the RFC. Only text bounded by "" is meant as exact. The rest is BNF
syntax and 'variables'.

So 'cache-request-directive' and 'cache-response-directive' are not meant
to be actually in the header.

That should be:
  "Cache-Control: no-cache;"

probably "Cache-Control: no-cache max-age=1 no-store;" to cover all the
bases.


>       buf[127] = '\0';
>       ci_request_add_xheader(req, buf);
> snprintf(buf, 128, "Expires: -1;");
>       buf[127] = '\0';
>       ci_request_add_xheader(req, buf);
>
> my custom web page is still kept displaying . Any comments?
>

Apparently "Expires: -1;" is invalid. Better to use an explicit timestamp,
even if its Jan 1970, just to be sure that it works as expected.


Keep in mind. The changes you make will always only be visible after the
previously bad version has been dropped from cache.

Amos



Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by Henrik Nordstrom-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On mån, 2007-10-01 at 09:28 +1300, Amos Jeffries wrote:

> Apparently "Expires: -1;" is invalid. Better to use an explicit timestamp,
> even if its Jan 1970, just to be sure that it works as expected.

-1 is invalid, which by specifications means expired in the past. See
RFC2616 14.21 Expires.

But yes, it's better to use a correct date as the messages you send
should comply with specifications, not just make the receiver do what
you intended..

Regards
Henrik


signature.asc (316 bytes) Download Attachment

Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by JXu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi  Amos and Henrik

Thank you for your reply.

I did the following tests:

             snprintf(buf, 128, "Cache-Control: no-cache;");
//also    snprintf(buf, 128, "Cache-Control: no-cache max-age=1 no-store;");
//also  snprintf(buf, 128, "Cache-Control: no-cache, max-age=1, no-store;");
//also  snprintf(buf, 128, "Cache-Control: no-cache; max-age=1; no-store;");
      buf[127] = '\0';
      ci_request_add_xheader(req, buf);
 //with or without snprintf(buf, 128, "Expires: Thu, 01 Dec 1994 16:00:00 GMT;");
  //with or without     buf[127] = '\0';
  //with or without         ci_request_add_xheader(req, buf);

For all above options I selected my custom web page is still kept displaying .
I must be wrong!

Any suggestion.

Thank you again!
Forrest









>Ah, it looks like you are slightly misunderstanding the BNF descriptions
>in the RFC. Only text bounded by "" is meant as exact. The rest is BNF
>syntax and 'variables'.

>So 'cache-request-directive' and 'cache-response-directive' are not meant
>to be actually in the header.

>That should be:
 > "Cache-Control: no-cache;"

>probably "Cache-Control: no-cache max-age=1 no-store;" to cover all the
>bases.

Henrik Nordstrom-5 wrote:
On mån, 2007-10-01 at 09:28 +1300, Amos Jeffries wrote:

> Apparently "Expires: -1;" is invalid. Better to use an explicit timestamp,
> even if its Jan 1970, just to be sure that it works as expected.

-1 is invalid, which by specifications means expired in the past. See
RFC2616 14.21 Expires.

But yes, it's better to use a correct date as the messages you send
should comply with specifications, not just make the receiver do what
you intended..

Regards
Henrik

 

Parent Message unknown Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by Christos Tsantilas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Forest,

The Cache-Control and Expires headers must contained at the headers of the
http response. The ci_request_add_xheader function you are using adds
headers to the icap headers response. (the ci_respmod_add_header is the
function you need ....)

Regards,
      Christos

PS.
 For problems related with c-icap better use the c-icap's mailing list:
     http://sourceforge.net/mailarchive/forum.php?forum_name=c-icap-users


> I did the following tests:
>
>     snprintf(buf, 128, "Cache-Control: no-cache;");
> //also    snprintf(buf, 128, "Cache-Control: no-cache max-age=1
> no-store;");
> //also  snprintf(buf, 128, "Cache-Control: no-cache, max-age=1,
> no-store;");
> //also  snprintf(buf, 128, "Cache-Control: no-cache; max-age=1;
> no-store;");
>       buf[127] = '\0';
>       ci_request_add_xheader(req, buf);
>  //with or without snprintf(buf, 128, "Expires: Thu, 01 Dec 1994 16:00:00
> GMT;");
>   //with or without     buf[127] = '\0';
>   //with or without         ci_request_add_xheader(req, buf);
>
> For all above options I selected my custom web page is still kept
> displaying
> .
> I must be wrong!
>
> Any suggestion.
>
> Thank you again!
> Forrest
>
>


Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by JXu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Christos,

You solve my problem.

Thank you for every body here.

Forrest

Christos Tsantilas wrote:

>
> Hi Forest,
>
> The Cache-Control and Expires headers must contained at the headers of the
> http response. The ci_request_add_xheader function you are using adds
> headers to the icap headers response. (the ci_respmod_add_header is the
> function you need ....)
>
> Regards,
>       Christos
>
> PS.
>  For problems related with c-icap better use the c-icap's mailing list:
>      http://sourceforge.net/mailarchive/forum.php?forum_name=c-icap-users
>
>
>> I did the following tests:
>>
>>     snprintf(buf, 128, "Cache-Control: no-cache;");
>> //also    snprintf(buf, 128, "Cache-Control: no-cache max-age=1
>> no-store;");
>> //also  snprintf(buf, 128, "Cache-Control: no-cache, max-age=1,
>> no-store;");
>> //also  snprintf(buf, 128, "Cache-Control: no-cache; max-age=1;
>> no-store;");
>>       buf[127] = '\0';
>>       ci_request_add_xheader(req, buf);
>>  //with or without snprintf(buf, 128, "Expires: Thu, 01 Dec 1994
>> 16:00:00
>> GMT;");
>>   //with or without     buf[127] = '\0';
>>   //with or without         ci_request_add_xheader(req, buf);
>>
>> For all above options I selected my custom web page is still kept
>> displaying
>> .
>> I must be wrong!
>>
>> Any suggestion.
>>
>> Thank you again!
>> Forrest
>>
>>
>
>
>

--
View this message in context: http://www.nabble.com/can-I-remove-cache-feature-from-Squid-or-how-can-I-make-the-time-of-cache-is-very-short-tf4542212.html#a12980520
Sent from the Squid - Development mailing list archive at Nabble.com.


Re: can I remove cache feature from Squid or how can I make the time of cache is very short

by JXu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Christos,
You have solved my problem!

Thank you everybody here.

Cheers,
Forrest

Christos Tsantilas wrote:
Hi Forest,

The Cache-Control and Expires headers must contained at the headers of the
http response. The ci_request_add_xheader function you are using adds
headers to the icap headers response. (the ci_respmod_add_header is the
function you need ....)

Regards,
      Christos

PS.
 For problems related with c-icap better use the c-icap's mailing list:
     http://sourceforge.net/mailarchive/forum.php?forum_name=c-icap-users


> I did the following tests:
>
>     snprintf(buf, 128, "Cache-Control: no-cache;");
> //also    snprintf(buf, 128, "Cache-Control: no-cache max-age=1
> no-store;");
> //also  snprintf(buf, 128, "Cache-Control: no-cache, max-age=1,
> no-store;");
> //also  snprintf(buf, 128, "Cache-Control: no-cache; max-age=1;
> no-store;");
>       buf[127] = '\0';
>       ci_request_add_xheader(req, buf);
>  //with or without snprintf(buf, 128, "Expires: Thu, 01 Dec 1994 16:00:00
> GMT;");
>   //with or without     buf[127] = '\0';
>   //with or without         ci_request_add_xheader(req, buf);
>
> For all above options I selected my custom web page is still kept
> displaying
> .
> I must be wrong!
>
> Any suggestion.
>
> Thank you again!
> Forrest
>
>