[dancer-users] Setting static files to 304 - Not modified

Olaf Alders olaf at wundersolutions.com
Tue Dec 3 03:34:30 GMT 2013


On 2013-12-02, at 10:24 PM, Matt Mallard wrote:

> Hi,
> 
> I've using Dancer2 with Plack/mod_perl with Apache (I was previously using Dancer with CGI, but can't get CGF or FCGI to work with Dancer2).
> 
> How to I set my static files to report '304 - Not modified' to the browser?  When I use Firebug to look at all the file load times and turn browser caching on, all the files from CDNs report '304 - Not modified', but all those served through Dancer report as '200' and hence are transferred each time.  This is fine for the dynamic pages, but unnecessary for the static files (logos, css, javascripts).


Hi Matt,

If you're using Apache, there's no reason to have Dancer serve your static files.  You'll get better performance if you let Apache just serve the static content directly.  You may want to have a look at http://httpd.apache.org/docs/2.2/mod/mod_expires.html and "A Brief Guide to Conditional Requests" in http://httpd.apache.org/docs/2.2/caching.html

Best,

Olaf
--
Olaf Alders
olaf at wundersolutions.com

http://www.wundersolutions.com
http://twitter.com/wundercounter



More information about the dancer-users mailing list