Skip to content

net/http: serveError removes "Content-Encoding" which breaks our system (GODEBUG=httpservecontentkeepheaders=0) #71138

Closed as not planned
@martinrode

Description

@martinrode

Go version

go version go1.23.2 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='arm64'
GOBIN='/Users/martin/go/bin'
GOCACHE='/Users/martin/Library/Caches/go-build'
GOENV='/Users/martin/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/martin/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/martin/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/martin/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/martin/go/src/github.com/programmfabrik/fylr/go.mod'
GOWORK='/Users/martin/go/src/github.com/programmfabrik/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/4f/l31kb4n521d6g89qxrwcx69h0000gp/T/go-build1664119454=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

We serve simple web pages using a compress handler (middleware).

This handler sets the header "Content-Encoding" to "gzip" if requested. If the served page ends up in a 404 and is served via net/http.serveError, the newly introduced deletion of http headers breaks the output of our system.

What did you see happen?

"Content-Encoding" header gets removed, but our content is still gzipped..

What did you expect to see?

I can see a reason why Cache-Control, Etag and Last-Modified makes sense to delete, but I don't see a reason to reset "Content-Encoding", but please remove the "Content-Encoding" from the list of deleted headers in net/http.serverError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions