Let me start from middle. I have been play around for a long time with these three part:
- nginx which handles the path
- Fastapi server
- sqlAdmin
The url https://example.com/gem/admin must be passed to sqlAdmin but there is this agonizing contrast.
If nginx configs like:
location /gem/admin/ { proxy_pass http://172.18.0.18:80/;
and sqlAdmin like:
admin = Admin( application, engine, authentication_backend=authentication_backend, base_url="/admin", title="Gem Admin Panel" )
request will not be passed to sqlAdmin and be served by FastApi like
{"detail":"Not Found"}
If I remove base_url then the styles url would be wrong like (missing admin):
https://example.com/gem/statics/css/fontawesome.min.css
If I remove trailing slash from nginx location and proxypass then it will add another admin to url resulting to 404 error.
it is frustrainting really. Please help me out.
base_url="/admin"but notbase_url="/gem/admin"?locationdirective prefix and theproxy_passdirective upstream URI part, wouldn't it be better to read the documentation? If you don't understand the difference between theproxy_pass http://172.18.0.18andproxy_pass http://172.18.0.18/directives and the nginx documentation is too complicated for you, you can read this answer, where I quote the documentation excerpts regarding the rules thatproxy_passfollows to pass the request URI to the backend./gemURI prefix comes from, but according to the configuration you've shown, you probably need to definebase_urlas/gem/adminand use the following location block:location /gem/admin/ { proxy_pass http://172.18.0.18; }(Without the trailing slash! You don't need the/gem/adminrequest URI prefix to be stripped from the URI that goes to the backend! The port 80 is the default port for the plain HTTP protocol and can be omitted.)