Jump to content
dust259

Can't connect to a PostgreSQL Database using a Traefik reverse proxy

Recommended Posts

Hi, for a few weeks I'm trying to add Traefik as a reverse proxy into our server setup. I'm using the Devart UniDAC Components to connect to the database. On connect I get the following error:

Quote
SSL_do_handshake = -1
SSL_get_error(..., r2) = 5
r2 = -1

Some more infos:

- SSL is active (TLSv1.2 and TLSv1.3 are allowed)

- I added the latest version of the libssl-1_1.dll and libcrypto-1_1.dll

- I tried the ZeosLib, but got the same error (SSL_do_handshake = -1)

- Connecting to the Database or pooler via IP works fine

- Database Tools like PSQL, pgAdmin and dbBeaver can connect to the DB via reverse proxy without problems

- I also build a simple C# application using the NpgsqlConnection which can connect to the DB via the proxy without problems 

- I added the Devart SecureBridge Components to get rid of the dependency on the openssl dlls. But this only resulted in another error (moste likely originating in the TPGConnection):

Quote

Connection is closed

 

- I was able to use the FireDAC components (using the 64bit libpq.dll) to connect to the server. But my application is compiled on 32bit, there doesn't seem to be a current Version of the dll compiled for 32bit (the newest 32 bit one is v10 (depreciated), but can not connect to my server).

- On the server I don't get any logs when the connection is closed. While debugging I sometimes got this error: 

Quote

ERROR: ObjectCache.run ProtocolError("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

 

I'm in contact with the Devart Support for two weeks now, but they seem puzzled too. I have a few questions:
1. Has anyone faced similar problems when trying to connect to a reverse proxy in combination with TLSv1.2&TLSv1.3?

2. Is it really true that the FireDAC components effectively can not connect to a Postgres Server on 32 bit because there is no current libpg.dll?

3. Can you recommend me an alternative to the Devart components which does not rely on the libpg.dll?

 

Edited by dust259

Share this post


Link to post

I can confirm that FireDAC and the 32-bit version 10 libpq.dll works fine with the supported 64-bit versions of PostgreSQL (12-16) including those running on Linux, FreeBSD and Azure.

 

I can't help you with the TLS and reverse proxy stuff 😉

Edited by weirdo12

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×