-
-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclusion list for static files middleware #548
Comments
There is a specific config colder for templates. You need just configure that folder (check the server side example) and put the html there. |
We've set
However browsing to localhost:8060/www/html/index.html returns us the raw content of the index.html file rather than blocking the request. We need to block any direct access to these html files. It should only be available via a registered controller path action, such as '/view/' in which case it will get rendered via the mustache engine and the appropriate substitutions take place. Are there other settings that need to be configured ? |
The ViewPath must not be addressable by the staticfile Middleware. |
And that is the problem. The external design agency delivers a zip file with the html template file sitting alongside the other UI files (css/js/etc). The deployment is simple if we just copy all of their files to the server, without having to extract and move the html template files. |
Ah Yes! I got the point. I think we could just inject an anonmethod with a signature similar to the following: procedure (const PathInfo: String; var Allow: Boolean)
begin
// do your logic
end; If the anonmethod is |
Thanks. I'll play around with something tomorrow and come back with a proposal / example. |
David, I had some time to wok on this, check this solution please |
Very useful, thanks Daniele for the enhancement, and the additional flexibility in the last iteration of the solution. I'm happy to accept that as the fix. |
On of our projects has all of the ui designed by an external web agency. They deliver us a file structure like this
We point our static files middleware to the root directory so that the js/css/img/etc files can be served directly. However we wish to exclude the html directory as it contains page fragments that need to be rendered by the mustache engine (effectively it is our ui source code)
Currently we handle this with a separate middleware which blocks the static files middleware from serving specified directories under the "\www" root, such as the html directory.
I'm thinking this must be a common situation and would like to propose a solution, some ideas I'm considering are:
I'll look into this in the coming week, but in the meantime happy to hear any other thoughts.
The text was updated successfully, but these errors were encountered: