> On 8/8/07, Amos Jeffries <squid3@treenet.co.nz> wrote:
>> > Hi,
>> >
>> > i have a servlet which returns content of a video file:
>> > like this:
>> > http://127.0.0.1:8080/videoServlet?id=1
>> > http://127.0.0.1:8080/videoServlet?id=2
>> >
>> > I hit that servlet thru squid as the proxy.
>> > I do this to query if squid does cache the video file:
>> >
>> > ./squidclient -H "Cache-Control: only-if-cached\n"
>> > "http://127.0.0.1:8080/videoServlet?id=1"
>> >
>> <snip>
>> >
>> > Can you please tell me why squid can't cache a video file?
>>
>> Firstly,
>> Check the webserver is providing the proper Cache-Control, and/or
>> Expires
>> headers that allow caching.
>>
>
> Thank you. In the servlet, it sets the content type:
>
> response.setContentType("video/mp4");
>
> and content length and cache control:
> response.setHeader("Content-Length", Long.toString(length) );
> response.setHeader("Cache-Control", "max-age=3600");
>
> Is that enough?
>
I think it should be enough to cache for 1 hour.
You can check whether they are making it out of the servlet to the general
web by testing it with the cachability engine.
http://www.ircache.net/ (under Tools->Cachability checker)
The ACLs I also mentioned may be important as they override the headers.
>
>> Secondly,
>> If you are using the default squid.conf settings:
>> acl QUERY urlpath_regex cgi-bin \?
>> cache deny QUERY
>>
>> that will prevent anything with a dynamic query-string from being
>> cached.
>> You maybe want to use something like:
>> acl Servlet urlpath_regex videoServlet\?
>> cache allow Servlet
>>
>> ahead of that default config line.
>>
>>
>> Amos
>>
>>
>>
>>
>> > Thank you.
>> >
>>
>>
>>
>
Received on Wed Aug 08 2007 - 17:35:27 MDT
This archive was generated by hypermail pre-2.1.9 : Sat Sep 01 2007 - 12:00:03 MDT