You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Node.js 22, the llhttp library introduced a breaking change by modifying its default behavior. A new check for "data after close" has been added, which causes unexpected failures when using the proxy-agents library in certain configurations.
Problem:
When using the latest version of Node.js (22) in combination with:
axios
http-proxy-agent
proxy-chain (which listens to clientError events as seen here)
All requests fail with a Data after "Connection: close" error.
Observations:
The issue seems to arise because headers are sent twice during the request. Below is an example:
POST http://[::]:33155/ HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json
User-Agent: axios/1.7.7
Content-Length: 11
Accept-Encoding: gzip, compress, deflate, br
Host: [::]:33155
Proxy-Connection: close
Connection: close
{"test":55}POST http://[::]:33155/ HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json
User-Agent: axios/1.7.7
Content-Length: 11
Accept-Encoding: gzip, compress, deflate, br
Host: [::]:33155
Proxy-Connection: close
Connection: close
HTTP/1.1 400 Bad Request
This behavior has existed in earlier Node.js versions but did not cause failures. With Node.js 22, however, the new llhttp checks result in the request being rejected.
Potential Solution:
I have created a branch to reproduce the issue and explore a potential fix: Branch: fix/test-node-22.
In this branch, I added a workaround that prevents headers from being sent twice. However, I am not entirely sure about the necessity of certain calls within the code. Additional input and review would be highly appreciated to verify the solution and ensure it aligns with the library's intended functionality.
Let me know if you need any more information or clarification. I’d be happy to provide additional details or assist with further testing.
The text was updated successfully, but these errors were encountered:
In Node.js 22, the llhttp library introduced a breaking change by modifying its default behavior. A new check for "data after close" has been added, which causes unexpected failures when using the
proxy-agents
library in certain configurations.Problem:
When using the latest version of Node.js (22) in combination with:
axios
http-proxy-agent
proxy-chain
(which listens toclientError
events as seen here)All requests fail with a
Data after "Connection: close"
error.Observations:
The issue seems to arise because headers are sent twice during the request. Below is an example:
This behavior has existed in earlier Node.js versions but did not cause failures. With Node.js 22, however, the new llhttp checks result in the request being rejected.
Potential Solution:
I have created a branch to reproduce the issue and explore a potential fix: Branch: fix/test-node-22.
In this branch, I added a workaround that prevents headers from being sent twice. However, I am not entirely sure about the necessity of certain calls within the code. Additional input and review would be highly appreciated to verify the solution and ensure it aligns with the library's intended functionality.
Let me know if you need any more information or clarification. I’d be happy to provide additional details or assist with further testing.
The text was updated successfully, but these errors were encountered: