@niwinz: How would you recommend placing static assets under a "guarded" route (a route that requires authentication in order to be used). I have a authentication checking handler but I cannot use it in combination with :assets
.
It is possible to do the this but it requires that your static assets sit under some sort of endpoint when I do not want them to be under any endpoint.
[:prefix "app"
[:any #'handlers/require-auth]
[:assets "" {:dir "target"
:indexes ["index.html"]}]]
Good question
I think that there are two possible solutions.
[[:prefix "assets"
[:any auth-handler]
[:assets "" opts]]]
this is an option but I don't know if it will work.
and an other option is
[[:scope
[:any auth-handler]
[:assets "assets" opts]]]
Putting this on the end of the pipeline
If nothing of that does not works. Tomorrow with calm I will fix it properly.
I'll test it out and let you know
As far as I can understand the ratpack code the first method should work
I have read a little bit about how it works and surelly for the next version I will add facilities for build own handlers for serving assets allowing user fully control over file serving 😉
and now I'm go away
Awesome thanks! :simple_smile: