On 09/12/2014 02:35 PM, Sawyer X wrote:
Unfortunately that is a terrible example. The concept of blocking all requests in a before() hook is... let's say, naive. In reality you would like to simply block specific requests according to session, a la David Golden's Auth::Tiny.
The before hooks are basically run on every request. Static files are now served through the File handler. That means it will trigger the before hooks because it's a normal request. I would love to do it using the Static middleware, but then it will happen before a route check on it, so we can't have that.
I still disagree with this change of behaviour from Dancer 1 to Dancer 2. What is the benefit of calling before hook for public files? Also in a production environment you might deliver static files with some other software (Nginx, ...) and you loose control on these public files anyway. Regards Racke -- Perl and Dancer Development Visit our Perl::Dancer conference 2014: http://act.perl.dance/