Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgadmin does not respect reverse proxy any more #5507

Closed
fjf2002 opened this issue Nov 8, 2022 · 6 comments
Closed

pgadmin does not respect reverse proxy any more #5507

fjf2002 opened this issue Nov 8, 2022 · 6 comments
Assignees
Milestone

Comments

@fjf2002
Copy link

fjf2002 commented Nov 8, 2022

Hello,

I have an Nginx reverse proxy configuration something like

    proxy_set_header X-Script-Name /pgadmin;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $host;

... that was working a few months ago (also cf. #4552).

Now it's broken, unfortunately. For example, shortly after clicking the login button, pgadmin calls many URLs not containing the X-Script-Name, as I can see in Chrome Devtools. For example:

GET https://mydomain/static/css/webcabin.overrides.css?v=1667892035310 net::ERR_ABORTED 404 (Not Found)
POST https://mydomain/browser/master_password 404 (Not Found)
GET https://mydomain/browser/check_corrupted_db_file 404 (Not Found)
GET https://mydomain/misc/bgprocess/ 404 (Not Found)
POST https://mydomain/settings/store 404 (Not Found)
POST https://mydomain/misc/cleanup 404 (Not Found)
@kekru
Copy link

kekru commented Nov 8, 2022

Same problem here.

The first wrong request for me is https://example.com/browser/nodes/, running with PGADMIN_CONFIG_SERVER_MODE=False

According to https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html I'm also a little confused about the nginx config. When I look at the Traefik config, it seems that the new path prefix must not be stripped away.

That means we should not have slashes after location and proxy_pass.
The following sample from the docs wil cause nginx to strip the /pgadmin4 before forwarding to pgAdmin

location /pgadmin4/ {
        proxy_set_header X-Script-Name /pgadmin4;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header Host $host;
        proxy_pass http://localhost:5050/;
        proxy_redirect off;
}

I think it should be

location /pgadmin4 {
        proxy_set_header X-Script-Name /pgadmin4;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header Host $host;
        proxy_pass http://localhost:5050;
        proxy_redirect off;
}

Update:
I added an example project to reproduce the error: https://gist.github.com/kekru/eaa6678b1169441f6dba119d546a67b2

@bigteejay
Copy link

Upon my trying the same, I am presented with the expected login screen.

After successful login (no error message), rather than being redirected to something like the X-Script-Name path (eg: /subdir1) and a usable interface, I am redirected to the web/server root (/, which in my nginx.conf, there is nothing for that route).

If I try going back to /subdir1 I am then redirected to a logged in subdir1/browser/ and the site/app is usable. How can the redirect ignoring X-Script-Name after login be solved?

@bigteejay
Copy link

This may be related to a fix introduced in 6.14?

@akshay-joshi
Copy link
Contributor

Fixed in PR #5523

@yogeshmahajan-1903
Copy link
Contributor

This is working fine . Verified with Desktop & Server mode configured with nginx reverse proxy.

@yogeshmahajan-1903 yogeshmahajan-1903 moved this from In Testing to ✅ Done in Current Sprint (183) Nov 16, 2022
@fjf2002
Copy link
Author

fjf2002 commented Nov 16, 2022

I can confirm: the bug is solved in 6.16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants