Repository navigation
net/http: http.Get fails with "connection reset by peer" after update to Go 1.23 but works flawlessly up to 1.22.8 #70139
Description
Activity
Related Issues and Documentation
- net/http: provide better error message when proxy is misconfigured #29809
- net: TCPConn.ReadFrom hangs when io.Reader is TCPConn or UnixConn, Linux kernel < 5.1 #63795 (closed)
- net/http: permanently broken connection with error "read: connection reset by peer" when response body is not closed #36700
- net/http: Error fetching URL: Get "http://www.google.com": proxyconnect tcp: dial tcp: lookup http: no such host #61436 (closed)
- proxy.golang.org, cmd/go, net/http: http2 PROTOCOL_ERRORS from the proxy #69544 (closed)
- net/http: `readLoopPeekFailLocked: <nil>` from client when server sends response immediately #31259
- net/http: http.Get: connection reset by peer on macOS #23158 (closed)
- net/http: Get request hangs until timeout, but responds immediately over curl #61823 (closed)
- vhost doesn't work correctly in the http protocol in net/http package #58601 (closed)
- net/http: ServeContent()/ServeFile() doesn't return expected response when WriteTimeout happens #43822 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Reacted by Roozbeh SharifnasabCC @neild @golang/security
Thanks for providing a small test case. Unfortunately, I can't recreate the problem. In all cases when I run your program I get
Successfully downloaded 11438 byte(s)I've tried with various language versions in go.mod and various compiler versions.
- addedNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Oct 31, 2024 Thanks for your answer. For us, it works on most machines but fails on all 30+ ci agents and I have no more idea what could cause this issue. Is there some way to debug this further?
I think you need to look at your proxy. It's the one that's terminating the connections.
- addedWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.
on Oct 31, 2024 Try
GODEBUG=tlskyber=0(and in general when debugging a breakage between releases, try switching the updated GODEBUGs one by one). If it fixes it, you have a proxy affected by https://tldr.fail or otherwise incompatible with post-quantum key shares in a non-compliant way.I think you need to look at your proxy. It's the one that's terminating the connections.
But when I compile with go 1.22.8 (or lower) it works with the same proxy, only when using go 1.23.0 or higher and everything else is exactly the same, it fails.
Try
GODEBUG=tlskyber=0(and in general when debugging a breakage between releases, try switching the updated GODEBUGs one by one). If it fixes it, you have a proxy affected by https://tldr.fail or otherwise incompatible with post-quantum key shares in a non-compliant way.Thank your for your hint. I now went thru all the GODEBUG Values, my
go env(which is used for building and then immediately running the application) showsGODEBUG='httpservecontentkeepheaders=1,x509keypairleaf=0,tls3des=1,jstmpllitinterp=1,x509negativeserial=1,tlskyber=0,winreadlinkvolume=0,winsymlink=0,asynctimerchan=1'but I still get the same error with go 1.23 but not with 1.22. Is there anything else I could try?Nevermind. I set it in the wrong layer (my app runs nested in one more container that was missing the GODEBUG).
I've addedgodebug tlskyber=0to mygo.modand now it works correctly so it is indeed a problem with one of our corporate proxies. Thank you for all the support (and new information about GODEBUG). I'll close this as it is not an issue with Go itself.Glad we could help! If you can share any details about the proxy, sometimes we can backchannel to the vendors, or at least document it for the next person.
I'll see if I can get that information and post back here and also in tldr.fail.
Reacted by Filippo ValsordaSorry for the late reply. But here are the data:
The software istBroadcom ProxySG
The issue was fixed by the vendor with version7.3.22.1Reacted by Adrian ZielinskiI have same problem
go1.20.3
go1.22.8
go1.22.12When I attempt to fetch
500items at once using http.Get(url very long),
the request succeeds with the http scheme but fails with the https scheme, resulting in a "read: connection reset by peer" error.&tls.Config{InsecureSkipVerify: true}invalid
no this problem in postman
no this problem when fetch50items at once(using http.Get)- added a commit that references this issue
on Feb 25, 2026 - locked and limited conversation to collaborators
on Apr 15, 2026
Go version
go version go1.23.2 linux/amd64
Output of
go envin your module/workspace:What did you do?
I have a very simple repro app that just downloads a file via
http.getThe code for this is:
This code is compiled and runs in a container in a GitLab pipeline. The http_proxy and https_proxy variables are set as a proxy is needed for the CI to connect to the outside world.
What did you see happen?
The code above works great if the go version in
go.modist at max1.22.8. As soon as I set it to1.23.0or higher, the download always fails withThis is 100% reproducible in our environment. 1.22.8 (or lower) always works, starting from 1.23.0 it always fails without changing anything else.
What did you expect to see?
In other environments (also on the lokal workstation with also needs a proxy), this works regardless of the go version but on all GitLab runners, it always fails and I am pretty much at a loss on what I could do more to fix this.