[Dancer-users] header does not seem to work correctly in all cases.

Nick Hibma nick at van-laarhoven.org
Mon Jan 10 10:00:56 CET 2011

Hi there,

I have some trouble getting 'header' / 'headers' to work. They don't work with send_file:

dancer headerTest
cd headerTest
cat << EOF
package headerTest;
use Dancer;

use Dancer::Plugin::Database;

get '/1' => sub {
   header 'Cache-Control' => 'This is a test';
   template 'index';
get '/2' => sub {
   header 'Cache-Control' => 'This is a test';
   send_file '/css/style.css';
get '/3' => sub {
   header 'Cache-Control' => 'This is a test';
   return {hello=>'world'};

./headerTest.pl --daemon
curl -v -v -o /dev/null http://localhost:3000/1
curl -v -v -o /dev/null http://localhost:3000/2
curl -v -v -o /dev/null http://localhost:3000/3

Note that with /2 the header Cache-Control is not set in the headers.

Also, I would like to set (cache-control) headers on CSS and JS files delivered from /public/ if possible, to reduce page load times (jQuery + Highcharts + jQueryUI slow things down :-).

If anyone could help me with this, that would be much appreciated.


Nick Hibma
AnyWi Technologies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110110/d9665c66/attachment.htm>

More information about the Dancer-users mailing list