Skip to content

Fallback to non-SSL connection #2720

Open
@gabegorelick

Description

@gabegorelick

The default sslmode in libpq is prefer:

first try an SSL connection; if that fails, try a non-SSL connection

It should be possible to have similar fallback behavior in node-postgres.

Currently, the following will fail with a The server does not support SSL connections error if the DB does not support TLS:

const client = new Client({ ssl: { rejectUnauthorized: true } });
await client.connect();

This requires knowing ahead of time whether the server supports TLS or not, even if we don't care about TLS.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions