drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.04k stars 1.06k forks source link

Aligned Static File Routes #2042

Open ProTankerAlfa opened 1 month ago

ProTankerAlfa commented 1 month ago

Currently, if drogon checks a route to a static file folder and does not find it, it returns not found, the desired behavior would be for it to continue checking subsequent routes like nginx, giving priority to larger routes, example:

"/static/an- folder/to-file/" over "/static/" is also desired

hwc0919 commented 1 month ago

I'm not quite following. Could you describe the situation in more detail? I'm not sure what you are refering by subsequent routes or Aligned.

ProTankerAlfa commented 2 weeks ago

I'm not quite following. Could you describe the situation in more detail? I'm not sure what you are refering by subsequent routes or Aligned.

example, there are 2 rules in the config.json locations, one has the uri_prefix: "/static/", and the other uri_prefix: "/static/images/pictures", and they have completely different aliases, the second has to have a higher search priority, and if nothing is found in it, instead of returning 404, it looks in /static/ alias and then, if nothing is found, returns 404

hwc0919 commented 2 weeks ago

The search order is the same as the config locations array. If you want to search "/static/images/pictures" first, you should put it in front of "/static/".

ProTankerAlfa commented 1 week ago

A ordem de pesquisa é a mesma da matriz de locais de configuração. Se você quiser pesquisar "/static/images/pictures" primeiro, você deve colocá-lo antes de "/static/".

Okay, that answers the priority, but what about checking in the other folder?

hwc0919 commented 1 week ago

It will only check the first matched url_prefix.