[Bug] Enpoints have wrong paths when behind proxy

From: Florian Loeffler <florian(dot)loeffler(at)fau(dot)de>
To: pgadmin-support(at)lists(dot)postgresql(dot)org
Subject: [Bug] Enpoints have wrong paths when behind proxy
Date: 2017-07-25 10:07:58
Message-ID: 913c3440-e31e-6499-7400-907fd99c5cc1@fau.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi list,

a bug to report, involving wrong paths generated for some resources when
pgadmin4 is running behind a proxy and under a another context path than
"/".
This leads to a non functional UI.

Version: pgadmin4-1.6-py2.py3-none-any.whl
OS: Ubuntu 16.04 LTS
Mode: Desktop

Steps to reproduce:
- Setup pgadmin4 to be running inside apache2 by following the
documentation at
https://www.pgadmin.org/docs/pgadmin4/1.x/server_deployment.html#apache-httpd-configuration-linux-unix
- Change the WSGIScriptAlias line to contain a subcontext, e.g.
change
WSGIScriptAlias /
/usr/local/lib/python2.7/dist-packages/pgadmin4/pgAdmin4.wsgi
to
WSGIScriptAlias /pgadmin4
/usr/local/lib/python2.7/dist-packages/pgadmin4/pgAdmin4.wsgi
- access localhost/pgadmin4 on your server
- multiple resources will not be accessible leading to some lements not
functioning (eg. the "Add server" button)

Proposed fix:
- add the current context path to the endpoints generated in
pgadmin/browser/templates/browser/js/endpoints.js

Unfortunately I have not enough understanding about the code to provide
a patch.
For me the fix was to just hardcode the "pgadmin4" path into the code
line directly.
That means I have the follwing now:
'{{ endpoint|safe }}': '/pgadmin4{{ url|safe }}'{% endfor %}

Hope this helps
Greetings
Flo

--
Florian Löffler, Zentrale Systeme
Regionales Rechenzentrum Erlangen (RRZE)
Friedrich-Alexander-Universität Erlangen-Nürnberg
Martensstraße 1, 91058 Erlangen, Germany
Tel. +49 9131 85-28146
florian(dot)loeffler(at)fau(dot)de
www.rrze.fau.de

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Ashesh Vashi 2017-07-25 10:12:01 Re: [Bug] Enpoints have wrong paths when behind proxy
Previous Message Dave Page 2017-07-21 20:56:25 Re: pgAdmin 4 v1.6 Released!