Re: [squid-users] Using squid to cache a video file

From: ying lcs <yinglcs@dont-contact.us>
Date: Wed, 8 Aug 2007 18:23:14 -0500

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?

> 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:23:17 MDT

This archive was generated by hypermail pre-2.1.9 : Sat Sep 01 2007 - 12:00:03 MDT