I got some trouble: pgadmin working perfect behind nginx in location /, but it wont work behind location /pgadmin Work great:
location / {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:5050;
}
Wont work:
location /pgadmin {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:5050;
}
May be i need some specific rewrite?
The fix seems to be not needed anymore.
According to Redmine issue, SCRIPT_NAME env var could be used (at least with latest official docker image).
Docker Compose snippet from the issue (working for me):
This was a bug in pgAdmin4 version 1.6, It is fixed now and will be available in next release.
Ref: Link
For version pgAdmin 4 v3.0, until the issue is actually fixed, here's a quick command-line hack based on this.
The commands above insert a piece of code into the file
/usr/local/lib/python3.5/dist-packages/pgadmin4/pgAdmin4.py
, right after the lineapp = create_app()
.Also, make sure the path to
pgAdmin4.py
on your system is correct. You may need to adjust the snippet above.Then, configure nginx as follows:
For reference, also have a look at pgAdmin4.py on GitHub.