Skip to content

http2: http1 fallback missing keepAlive? #59783

Description

@ronag

Not 100% sure how to http1 compat works but this looks suspicious:

import http2 from 'node:http2'
import https from 'node:https'
import { readFileSync } from 'node:fs'

const server = http2.createSecureServer({
  key: readFileSync('../proxy/cert/server.key'),
  cert: readFileSync('../proxy/cert/server.crt'),
  allowHTTP1: true,
})
.on('request', (req, res) => {
  console.log(req.httpVersion, server.keepAliveTimeout, server.keepAliveTimeoutBuffer) // 1.1 undefined undefined
})
.listen(9999)

https.get('https://localhost:9999', { rejectUnauthorized: false }, (res) => {
  res.end()
})

Activity

  1. added
    http2Issues and PRs related to the http2 subsystem.
    on Sep 6, 2025
  2. amyssnippet commented on Feb 7, 2026

    @amyssnippet
    Contributor

    hey @ronag , i reproduced it and found out that there is bug still in the latest build of nodejs as of today too

    const http2 = require('node:http2');
    const https = require('node:https');
    const fs = require('node:fs');
    const path = require('node:path');
    
    const key = fs.readFileSync(path.join(__dirname, 'test/fixtures/keys/agent1-key.pem'));
    const cert = fs.readFileSync(path.join(__dirname, 'test/fixtures/keys/agent1-cert.pem'));
    
    const server = http2.createSecureServer({
      key,
      cert,
      allowHTTP1: true,
    }).on('request', (req, res) => {
      console.log('HTTP Version:', req.httpVersion);
      console.log('KeepAliveTimeout:', server.keepAliveTimeout);
      console.log('KeepAliveTimeoutBuffer:', server.headersTimeout);
      res.end('ok');
      server.close();
    }).listen(9999);
    
    https.get('https://localhost:9999', { rejectUnauthorized: false }, (res) => {
      res.resume();
    });
    amol@Amols-MBP node % ./node ./repro.js 
    HTTP Version: 1.1
    KeepAliveTimeout: undefined
    KeepAliveTimeoutBuffer: 60000
  3. amyssnippet commented on Feb 7, 2026

    @amyssnippet
    Contributor

    I'd like to work on this! I'm opening a PR to fix it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues and PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions