Hi Olaf,
Thanks for the suggestion. It works using rewrite rules - mostly copied
from the CGI examples. I was thinking everything had to run through
mod_perl/plack if using that method. Here's the config for anyone else
using this method:
PerlSetupEnv On
SetEnv DANCER_ENVIRONMENT "production"
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
Alias /public /websites/testing/public
<Directory "/websites/testing/public">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
RewriteRule ^/images/(.*)$ /public/images/$1 [L]
RewriteRule ^/css/(.*)$ /public/css/$1 [L]
RewriteRule ^/javascripts/(.*)$ /public/javascripts/$1 [L]
RewriteRule ^/(google.*html)$ /public/$1 [L]
<Location />
SetHandler perl-script
PerlHandler Plack::Handler::Apache2
PerlSetVar psgi_app /websites/testing/bin/app.pl
</Location>
<Perl>
use lib "/usr/local/perl/lib/perl5/x86_64-linux-thread-multi";
use lib "/usr/local/perl/lib/perl5";
use lib "/websites/testing/lib";
</Perl>
To whom maintains the perldoc: it might be worth adding this to the
Plack on Apache Deployment option.
PS - I could not get Dancer2 to recognise production until I set
'PerlSetupEnv On'.
Regards,
Matthew
On 3/12/13 2:34 PM, Olaf Alders wrote:
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
[email protected]
http://www.wundersolutions.com
http://twitter.com/wundercounter
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users