What version of Go are you using (go version)?
$ go version
go version go1.17 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/adowns/Library/Caches/go-build"
GOENV="/Users/adowns/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/adowns/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/adowns/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/adowns/workspace/go/src/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4c/1b3s36l94blb6xg1_4p_13800000gn/T/go-build2945905512=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
- I ran a small app that set
Transfer-Encoding: chunked
- I ran a reverse proxy that points to the app.
- I curled the app via the reverse proxy.
See example in playground: https://play.golang.org/p/pRkFwyre5Bt.
What did you expect to see?
Prior to golang 1.16.0, the response would contain the Content-Length header.
What did you see instead?
Since golang 1.16.0, the response contains the Transfer-Encoding: chunked header.
I was able to use git bisect to narrow it down to this commit that changed things.
This change broke some of our clients and it would be nice to call it out in the release notes.
Current Release Note
ReverseProxy now flushes buffered data more aggressively when proxying streamed responses with unknown body lengths.
Link to release note
Proposed Release Note
ReverseProxy now flushes buffered data more aggressively when proxying streamed responses with unknown body lengths. Because of this, when a backend sends a small response with the Transfer-Encoding: chunked header, this header is no longer replaced with the Content-Length header.
Sending a CL momentarily.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Transfer-Encoding: chunkedSee example in playground: https://play.golang.org/p/pRkFwyre5Bt.
What did you expect to see?
Prior to golang 1.16.0, the response would contain the
Content-Lengthheader.What did you see instead?
Since golang 1.16.0, the response contains the
Transfer-Encoding: chunkedheader.I was able to use git bisect to narrow it down to this commit that changed things.
This change broke some of our clients and it would be nice to call it out in the release notes.
Current Release Note
ReverseProxy now flushes buffered data more aggressively when proxying streamed responses with unknown body lengths.
Link to release note
Proposed Release Note
ReverseProxy now flushes buffered data more aggressively when proxying streamed responses with unknown body lengths. Because of this, when a backend sends a small response with the
Transfer-Encoding: chunkedheader, this header is no longer replaced with theContent-Lengthheader.Sending a CL momentarily.