pgadmin-org / pgadmin-org/pgadmin4

Unable to run pgadmin4 web version with reverse proxy using Caddy

Open
#10,334 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Python
Stars
3.8k
Forks
891
Avg merge
4d 7h
Merged PRs (30d)
8

Description

When I try to run the web version of pgadmin4 behind the reverse proxy using caddy, the loading spinner comes and revolve continuously. The login page not come and hence unable to use pgadmin4 behind reverse proxy. While the login page is fully functional if I use my IP:PORT/pgadmin4

To Reproduce

Steps to reproduce the behavior:

  1. Install Caddy
  2. Add the config in /etc/caddy/Caddyfile (I have replaced the actual domain)
pgadmin.example.com {
        reverse_proxy 127.0.0.1:5433
}

where I have initialized my pgadmin4 server on 5433

  1. Try to open the domain on web ideally the login page should pop up and the pgadmin4 is accessible
  2. But below error message is shown on console of developer tool. And originally the spinner rotate for too long time and nothing really comes up.

Error message

[Error] Failed to load resource: bad URL (v4513226cdae34746b4dedf0b4dfa099e1781791509496, line 0)
[Error] Refused to execute https://pgadmin.example.com/pgadmin4/static/vendor/require/require.min.js?ver=91700 as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type.
[Error] ReferenceError: Can't find variable: require
	Global Code (login:54)
[Log] ReferenceError: Can't find variable: require — login:113 (login, line 123)
[Warning] Source Map "https://pgadmin.example.com/pgadmin4/static/js/generated/pgadmin_commons.js.map" has SyntaxError: JSON Parse error: Unrecognized token '<'

** Environment**

  • OS: Linux
  • pgAdmin version: latest
  • Mode: [Server]
  • Browser (if running in server mode): [chrome, safari]
  • Package type: [DEB, Python, Container] attempted tests using these might impact other package type too.

Additional context
It is better if there should be a document section under deployment using reverse proxy using Caddy this will help most of the user running Caddy for there deployment.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Caddyfile configuration and the browser console errors, especially the failed require.min.js load and incorrect MIME type. Reproduce the deployment with pgAdmin on port 5433 and determine why the login page fails behind Caddy; done means the login page loads through the domain, and the deployment guidance covers this setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.