Skip to content

Queries sent to HTTP2 endpoint with httpVersion:2 always reach port 80 #7249

@andrey-skaleet

Description

@andrey-skaleet

Describe the issue

Hi!
I'm trying to make use of v1.13.2 with HTTP2. I do API calls to a server behind a proxy that also support the HTTP2 (tested with curl and browser, SSL 1.2, ALPN h2, at port 443). Some servers behind this proxy support HTTP2, some not.

Now the problem is that whenever I call the server with httpVersion: 2 , I get this error:

node:events:497
2025-11-19T13:15:31.594802097Z       throw er; // Unhandled 'error' event
2025-11-19T13:15:31.594804864Z       ^
2025-11-19T13:15:31.594807097Z 
2025-11-19T13:15:31.594809199Z Error: C03CA6DB48710000:error:0A0000C6:SSL routines:tls_get_more_records:packet length too long:../deps/openssl/openssl/ssl/record/methods/tls_common.c:662:
2025-11-19T13:15:31.594811936Z 
2025-11-19T13:15:31.594813923Z Emitted 'error' event on ClientHttp2Session instance at:
2025-11-19T13:15:31.594816078Z     at emitClose (node:internal/http2/core:1164:10)
2025-11-19T13:15:31.594818610Z     at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
2025-11-19T13:15:31.594821061Z   library: 'SSL routines',
2025-11-19T13:15:31.594823169Z   reason: 'packet length too long',
2025-11-19T13:15:31.594825345Z   code: 'ERR_SSL_PACKET_LENGTH_TOO_LONG'
2025-11-19T13:15:31.594827480Z }

When I switch to httpVersion: 1 or remove this option altogether, then everything works fine.

And in the logs of our proxy server I see that when I use the httpVersion: 2 Axios client connects to port 80 instead of 443, producing [19/Nov/2025:13:15:31 +0000] "\x16\x03\x01\x06@\x01" 400 483 "-" "-" which, as I understand, is attempt of SSL connection instead of plain http 1.1 hence the port 80.
The host is always the same, preceded with https:// and with :443 to make sure the port is correct.

Am I missing some step in configuration or maybe it is even totally unrelated to Axios?

Example Code

Expected behavior

No response

Axios Version

1.13.2

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

No response

OS

No response

Additional Library Versions

Additional context/Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions