Node.js applications frequently employ HTTP/2 because it lowers protocol overhead, enhances client-server communication, and enables many requests to share a connection.
The implementation of HTTP/2 is more difficult than that of HTTP/1.1 due to the same protocol characteristics that make it beneficial. When an application gets traffic from untrusted clients, issues with connection handling, stream management, request processing, and resource restrictions may become security issues.

When a Node.js HTTP/2 security update becomes available, updating the Node.js runtime is only part of the work. Teams also need to check whether their applications are using the affected HTTP/2 functionality and whether the application configuration allows clients to consume excessive resources.
This article explains how to review a Node.js application after an HTTP/2 security fix, what areas should be checked, and how to test the application without changing unrelated parts of the system.
Why HTTP/2 Security Issues Need Application Review
A security fix in Node.js may address a problem inside the HTTP/2 implementation itself.
That means the vulnerable behavior may exist below your application code.
For example:
Client
|
v
Node.js HTTP/2
|
v
Application
|
v
Business Logic
If the issue exists in the HTTP/2 layer, the application may be vulnerable even when its own JavaScript code looks correct.
This is why reviewing the runtime version is important.
However, runtime version checking alone does not answer other important questions:
- Is the application actually using HTTP/2?
- Is HTTP/2 enabled directly or through a proxy?
- Which server APIs are being used?
- Are connection limits configured?
- Are long-lived streams expected?
- Is a reverse proxy involved?
- Are HTTP/2 clients exposed directly to the application?
These questions help determine the practical impact of the security update.
Start by Checking the Node.js Version
The first step is to identify the runtime used by the application.
Run:
node --version
You can also check the version used in the project configuration.
For example:
{
"engines": {
"node": ">=22"
}
}
The actual version requirement should match the supported runtime for your application and deployment platform.
Do not rely only on the Node.js version installed on your development machine.
Check the runtime used by:
- Local development
- CI/CD
- Docker images
- Virtual machines
- Kubernetes workloads
- Azure App Service
- Azure Container Apps
- Other hosting platforms
It is common for a developer's machine to run a newer Node.js version while production is still using an older runtime.
Check Where HTTP/2 Is Enabled
Search the application for HTTP/2 usage.
Common Node.js code includes:
const http2 = require("node:http2");
or:
import http2 from "node:http2";
A server may be created with:
const server = http2.createSecureServer({
key,
cert
});
If you find code like this, the application is directly using Node.js HTTP/2 APIs.
But the absence of this code does not necessarily mean the application never uses HTTP/2.
A reverse proxy may terminate HTTP/2 before forwarding HTTP/1.1 traffic to Node.js.
For example:
Client
|
| HTTP/2
v
Reverse Proxy
|
| HTTP/1.1
v
Node.js
In this setup, the Node.js application may not directly handle HTTP/2.
The reverse proxy becomes the component that needs to be reviewed for HTTP/2 security behavior.
Check the Entire Request Path
Modern applications often have several layers between the client and Node.js.
For example:
Internet
|
v
CDN
|
v
Load Balancer
|
v
Reverse Proxy
|
v
Node.js
A security review should identify which layer terminates the HTTP/2 connection.
This matters because the vulnerable protocol implementation may be located in a different component than the application server.
Ask these questions:
- Does the public endpoint support HTTP/2?
- Where is TLS terminated?
- Does the Node.js process receive HTTP/2 directly?
- Does a proxy convert HTTP/2 to HTTP/1.1?
- Which component controls HTTP/2 connection limits?
- Which component receives untrusted HTTP/2 traffic?
The answers determine where remediation needs to happen.
Review Node.js HTTP/2 APIs
If the application uses the Node.js HTTP/2 module directly, review how it creates and manages sessions.
For example:
const server = http2.createSecureServer({
key: fs.readFileSync("server.key"),
cert: fs.readFileSync("server.crt")
});
server.on("stream", (stream, headers) => {
stream.respond({
":status": 200,
"content-type": "text/plain"
});
stream.end("Hello");
});
The important part is not whether this exact code is vulnerable.
The important part is that the application is handling HTTP/2 streams directly and should therefore be tested after the runtime security update.
Review:
- HTTP/2 sessions
- Streams
- Request headers
- Response headers
- Stream lifecycle
- Error handling
- Connection limits
- Long-lived streams
- Server shutdown behavior
Understand HTTP/2 Streams
HTTP/2 uses streams to allow multiple requests and responses over a single connection.
Conceptually:
One TCP connection
|
+-- Stream 1
+-- Stream 2
+-- Stream 3
+-- Stream 4
This is efficient, but it also means an application needs to handle many concurrent streams correctly.
An application that assumes one connection equals one request can behave incorrectly under HTTP/2.
For example, application state should not be associated with the connection unless there is a clear reason to do so.
Request-specific information should remain associated with the request or stream.
Avoid Shared Mutable State
HTTP/2 makes concurrency especially important.
Suppose a server stores the current request in a global variable:
let currentRequest;
Then:
server.on("stream", (stream, headers) => {
currentRequest = headers;
// Process request
});
This is unsafe because multiple streams can exist at the same time.
A safer approach is to keep request data inside the stream handler:
server.on("stream", (stream, headers) => {
const requestHeaders = headers;
// Process this stream using requestHeaders
});
The same principle applies to normal Node.js applications.
HTTP/2 does not make shared mutable state safe.
Check Request Header Handling
HTTP/2 allows many headers to be sent with a request.
Applications should avoid making assumptions about the number or size of headers.
For example, code like this:
const userAgent = headers["user-agent"];
is fine when the application only needs that specific header.
Problems can appear when the application copies every header into another object, logs everything, or performs expensive processing without limits.
Review:
- Header validation
- Header logging
- Header size assumptions
- Duplicate or unexpected headers
- Sensitive headers
- Authentication headers
Never log complete authorization headers or other secrets simply for troubleshooting.
Review Long-Lived Connections
Some applications intentionally keep HTTP/2 connections alive for long periods.
This can be normal for certain workloads, but it means connection management becomes important.
Review:
- Connection idle timeouts
- Stream timeouts
- Maximum concurrent streams
- Graceful shutdown
- Connection cleanup
- Error handling
Do not simply reduce all timeout values without understanding the application's traffic pattern.
A streaming application may legitimately need longer-lived connections than a typical REST API.
The goal is controlled resource usage, not arbitrary timeout reduction.
Check Reverse Proxy Configuration
If Node.js sits behind a reverse proxy, inspect the proxy configuration as well.
A common architecture is:
Client
|
| HTTP/2
v
Proxy
|
| HTTP/1.1
v
Node.js
In this architecture, the Node.js application may not be responsible for HTTP/2 negotiation.
The proxy handles the HTTP/2 connection.
Review:
- HTTP/2 enablement
- Connection limits
- Request limits
- Stream limits
- TLS configuration
- Timeout configuration
- Header forwarding
- Proxy upgrade behavior
Do not assume that upgrading Node.js alone fixes every HTTP/2 security exposure in the environment.
Check Docker Images
Containerized applications can easily run an unexpected Node.js version.
A Dockerfile might contain:
FROM node:22
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
CMD ["node", "server.js"]
The important question is which exact image version is actually being deployed.
Using a broad tag can make runtime behavior change when the image is rebuilt.
For production applications, consider using a controlled base image strategy and update it deliberately through the normal dependency and security process.
After updating the image, verify the runtime:
node --version
inside the container.
Check CI/CD Pipelines
The runtime used by CI can also differ from production.
For example, a GitHub Actions workflow might use:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm test
This only tells you what version is used during CI.
Your production deployment could still use another version.
Check the complete pipeline:
Source Code
↓
CI Node.js Version
↓
Build Artifact
↓
Container / Server Runtime
↓
Production
The runtime used for the final application matters most.
Review package-lock.json
Updating Node.js does not necessarily mean updating every npm dependency.
Do not use a security update as an excuse to upgrade unrelated packages without a reason.
Start by identifying the runtime issue and its affected components.
Then review dependencies separately.
Useful commands include:
npm outdated
and:
npm audit
The output from npm audit should be reviewed rather than blindly applying every suggested upgrade.
A dependency update can introduce a different application problem.
Keep the scope of the security fix controlled.
Test HTTP/1.1 and HTTP/2 Separately
After updating Node.js, test both protocols when the application supports both.
For example:
curl --http1.1 https://example.com/
and:
curl --http2 https://example.com/
This helps identify protocol-specific behavior.
If HTTP/1.1 works but HTTP/2 fails, investigate the HTTP/2 path rather than changing application logic that is unrelated to the protocol.
Test With a Realistic Load
A security fix may change how the runtime handles malformed or unusual HTTP/2 traffic.
Normal functional tests are important, but they may not exercise connection behavior under load.
Test scenarios such as:
- Multiple concurrent clients
- Multiple streams per connection
- Long-running requests
- Slow clients
- Large request headers
- Connection reuse
- Repeated connection creation
The goal is to confirm that the application remains stable after the runtime update.
Do not generate intentionally malicious traffic against a production system.
Use a controlled test environment for security and protocol stress testing.
Watch CPU and Memory Usage
After deploying the updated runtime, monitor resource usage.
Important metrics include:
- CPU
- Memory
- Request rate
- Request duration
- Active connections
- Error rate
- Restart count
- Container health
A runtime update may change behavior under certain traffic patterns.
Compare the application before and after the deployment.
For example:
Before update
CPU: stable
Memory: stable
Errors: low
After update
CPU: stable
Memory: stable
Errors: low
If memory usage starts increasing after deployment, investigate before assuming the HTTP/2 fix itself caused the problem.
Watch for Connection and Stream Errors
Application logs may contain errors related to:
ERR_HTTP2_PROTOCOL_ERROR
ERR_HTTP2_STREAM_ERROR
ERR_HTTP2_INVALID_SESSION
The exact error depends on the runtime and application behavior.
Do not treat every HTTP/2 error as a security issue.
First determine whether the error is:
- Client-generated
- Proxy-generated
- Application-generated
- Runtime-generated
- Caused by a network interruption
Look at the complete request path.
Review Graceful Shutdown
A production Node.js server should handle shutdown correctly.
For example:
const server = http2.createSecureServer(options);
process.on("SIGTERM", () => {
server.close(() => {
process.exit(0);
});
});
The exact shutdown behavior depends on the application's architecture.
The important point is that HTTP/2 connections may remain active during shutdown.
The application should stop accepting new work while allowing existing operations to finish within the configured limits.
This becomes especially important when containers are replaced during a deployment.
Do Not Disable HTTP/2 Without a Reason
One possible reaction to an HTTP/2 security issue is to disable HTTP/2 completely.
That may reduce exposure, but it can also remove features the application depends on.
Before disabling HTTP/2, determine:
- Whether the application uses it
- Whether the public endpoint requires it
- Whether the reverse proxy handles it
- Whether clients depend on it
- Whether the security update is already available
If a supported Node.js security update fixes the issue, upgrading the runtime is generally preferable to removing a protocol feature unnecessarily.
Test Streaming Applications Carefully
Some Node.js applications use HTTP/2 streaming.
For example:
server.on("stream", (stream, headers) => {
stream.respond({
":status": 200,
"content-type": "text/event-stream"
});
const interval = setInterval(() => {
stream.write("data: update\n\n");
}, 1000);
stream.on("close", () => {
clearInterval(interval);
});
});
Streaming changes the testing requirements.
Check:
- Client disconnect handling
- Stream cleanup
- Timer cleanup
- Memory usage
- Connection duration
- Graceful shutdown
A stream that is not cleaned up properly can continue consuming resources after the client has gone away.