drogonframework / drogonframework/drogon
Allow "locations" config entry to be applied to a single file
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
**Is your feature request related to a problem? Please describe.**
Currently the "locations" config entry applies throughout the directory, in particular "filters". While this may be desired in some applications, it creates performance issues in others. In my case I have two pages /login and /admin. Each one must have a separate filter to check login state, and redirect to the other page if the state is inconsistent with that page. Say you are logged in and visit /login, the LoginFilter will redirect to /admin. This works fine with "locations", however, the filters get called for all resources located within /login and /admin.
**Describe the solution you'd like**
To be able to specify a particular file for the filters to be applied on.
**Describe alternatives you've considered**
1. Check within the filters themselves at the top whether the request is for the index.html file itself, then do the login check logic, otherwise immediately let the request through and don't check for anything.
2. Extract the resources from /login and /admin to a different directory. This is the least intrusive solution, but changes the file structure of the frontend.
3. Create two controllers for /login and /admin, make a file HTTP response based on the login state. This is the least attractive solution.
Contributor guide
Assessment
This issue has not been assessed yet.