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'};
};
true;
EOF
./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.
Regards,
Nick Hibma
AnyWi Technologies