rio
rio copied to clipboard
[Feature Request]Support configuration of a "root-path" for entire project
Description
Currently, as far as I know, the default configuration of root path for web apps is / and that cannot be changed. So, for instance, we can start an app that answer requests on http://localhost:5000/ but not on http://localhost:5000/myapp/ If I am correct, the lack of this feature raises lots of problems with proxies, like nginx, when you run it in a subfolder. Although it is possible to configure nginx to strip the path before contacting the upstream, for some reason, that does not work with a rio app.
Suggested Solution
I'd suggest two possible solutions (both could apply simultaneously): provide a "root path" configuration option and/or use only relative paths in entire project.
Alternatives
I am not an expert in rio or related projects, but I tried setting somehow the root path option for uvicorn without any luck.
Additional Context
I have a nginx with a subfolder "/myapp/" that redirects to the app running in "http://upstream:5000/". Without any further configuration, an access to http(s)://mynginx/myapp/ won't work, because it will call /myapp/ on upstream. Striping the path in nginx could work, and it almost worked on calling / , but the page loaded requests resources on /rio (in other words, from the root path), that does not exist on nginx. sub_filter does not solve the problem because it cannot catch some strings inside javascript. Mapping /rio to the upstream, despite beeing a poor solution, still does not work. However, even in this scenario, all resources are correctly loaded by the browser, but the main page complains that the address does not exist.
Related Issues/Pull Requests
No response