How to Handle Request Timeouts in Go Web Servers

Web
Disable HTTP/2 in Go web servers and clients by setting GODEBUG=http2client=0,http2server=0 to prevent timeouts from buggy implementations.

Set the GODEBUG environment variable to http2client=0 or http2server=0 to disable HTTP/2 and prevent timeout errors caused by buggy implementations. This forces the Go HTTP client or server to use HTTP/1.1 exclusively.

export GODEBUG=http2client=0,http2server=0

Alternatively, set the default behavior in your go.mod file for Go 1.23+:

godebug (
	http2client=0
	http2server=0
)