这是indexloc提供的服务,不要输入任何密码
Skip to content

pgadmin in desktop mode behind (authenticated) proxy on sub-path does not work #5344

@LEDfan

Description

@LEDfan

Hi

First of all, thanks for this project and for helping with this issue.

We are planning to host pgadmin in ShinyProxy. In essence, we would have pgadmin running as a docker container dedicated to one user (so one container per user) and ShinyProxy will authenticate the access to this container. Therefore, we don't need authentication on pgadmin and we would have to run pgadmin on a sub-path.

It turns out that this combination does not work, as described in #5412.

Steps to reproduce

  1. Start the docker container:

    docker run -p 80:80  -e 'SCRIPT_NAME=/test' \
      -e 'PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False' \
      -e 'PGADMIN_CONFIG_SERVER_MODE=False' \
      -e 'PGADMIN_DEFAULT_EMAIL=user@domain.com' \
      -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' \
      dpage/pgadmin4
  2. go to http://localhost:80/test

Expected result

Pgadmin works.

Actual result

Pg admin does not work completely, because it tries to access some resources without using the sub-path:
image

Proposed solution

I had a quick look at the code and found this part interesting: https://github.com/pgadmin-org/pgadmin4/blob/master/web/pgadmin/__init__.py#L128-L134

I tried changing the if statement to if config.SERVER_MODE or "SCRIPT_NAME" in os.environ: and this solves the issue.
If you agree with this solution, I can prepare a PR, otherwise I'm interested whether you have an alternative solution.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions