On 8/8/07, Amos Jeffries <squid3@xxxxxxxxxxxxx> 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. > > > > >