Search code examples
postgresqldockerpgadminpgadmin-4

Pgadmin4: Invalid HTTP Version 'Invalid HTTP Version: 'on postgres@domain.tld HTTP/1.0''


--------------------------------------------------------
| Pgadmin version           |          4.3.5           |
--------------------------------------------------------
| PostgreSQL server version | pg_ctl (PostgreSQL) 11.1 |
--------------------------------------------------------
| Docker image              |      dpage/pgadmin4      |
--------------------------------------------------------

I ran into a problem using PGAdmin4 in Docker container. When i'm connecting to my host`s machine postgresql server and trying to view/edit data - i'm getting such error: https://pasteboard.co/HO1w7jS.png

Note that:

  • I have default postgresql configuration, except listen_addresses = '127.0.0.1, 172.17.0.1.
  • PGAdmin container is behind nginx proxy mydomain.tld -> localhost:5050

As i understand, it is a problem with postgresql HTTP API. But i'm not an expert neither in postgresql nor in pgadmin. Maybe anyone have solution to this problem?


Solution

  • The problem was in regular expression for nginx location. Nginx somehow strangely truncates the URL parameters.

    Perhaps this is due to the use of this patch: https://stackoverflow.com/a/50515636/9547899 (I use it to redirect requests to pgadmin to a subdirectory)

    It was:

    location ~ /PostgreSQL(.*)$ {
        proxy_pass          http://127.0.0.1:23301$1;
    

    It became:

    location ~ PostgreSQL {
        proxy_pass          http://127.0.0.1:23301;