FastAPI-Amis-Admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by django-admin, and has as many powerful functions as django-admin.
I used an nginx reverse proxy in front of my service. In this reverse proxy, I specified a path prefix that routes to the project, and in nginx, I used a rewrite to remove this prefix. For example, when a browser requests domain.com/prefix/admin, it actually requests the /admin path.
However, the frontend links generated by the project do not include the /prefix prefix. For example, domain.com/admin/page. This causes the frontend to be unable to access the correct backend address domain.com/prefix/admin/page.
How can I solve this problem? I've tried adding a root_path in the FastAPI app for admin, but it didn't work.
我在服务前面用到了一层nginx正向代理,正向代理中指定了一个path prefix路由到这个项目,并在nginx中用rewrite去掉了这个前缀,例如浏览器请求
domain.com/prefix/admin
,实际请求的就是/admin
。 但项目生成的前端链接中不包含/prefix
前缀,例如domain.com/admin/page
,导致前端无法访问正确的后端地址domain.com/prefix/admin/page
。 这个问题要如何解决? 我尝试过在admin的fastapi app中添加root_path
,没有效果。I used an nginx reverse proxy in front of my service. In this reverse proxy, I specified a path prefix that routes to the project, and in nginx, I used a rewrite to remove this prefix. For example, when a browser requests
domain.com/prefix/admin
, it actually requests the/admin
path.However, the frontend links generated by the project do not include the
/prefix
prefix. For example,domain.com/admin/page
. This causes the frontend to be unable to access the correct backend addressdomain.com/prefix/admin/page
.How can I solve this problem? I've tried adding a
root_path
in the FastAPI app for admin, but it didn't work.