Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http/httputil: ReverseProxy is not allowing to change the status message for the response #39415

Open
budanm opened this issue Jun 5, 2020 · 3 comments

Comments

@budanm
Copy link

@budanm budanm commented Jun 5, 2020

What version of Go are you using (go version)?

$ go1.13.3 windows/amd64

Does this issue reproduce with the latest release?

Have not upgraded to latest version yet

What operating system and processor architecture are you using (go env)?

set GO111MODULE=
set GOARCH=amd64
set GOBIN=C:\Users\xyz\Documents\GitHub\Go\workspace\bin
set GOCACHE=C:\Users\xyz\AppData\Local\go-build
set GOENV=C:\Users\xyz\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\xyz\Documents\GitHub\Go\workspace
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\xyz\Documents\GitHub\integration-gateway\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\xyz\AppData\Local\Temp\go-build906736114=/tmp/go-build -gno-record-gcc-switches

go env Output
$ go env

What did you do?

Overwrote the ModifyResponse method in Reversproxy and set the status of Response to a custom value. In addition to that changed the status code of the response as well

resp.StatusCode = 201
resp.Status = "Custom object created"

What did you expect to see?

Expected to see the status-code as well as the status message to change in the final response

What did you see instead?

Only the status code was changed, but the status message was never changed.

@dmitshur dmitshur added this to the Backlog milestone Jun 5, 2020
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jun 5, 2020

/cc @bradfitz per owners.

@dmitshur dmitshur changed the title net/http/httputil/ReverseProxy is not allowing to change the status message for the response net/http/httputil: ReverseProxy is not allowing to change the status message for the response Jun 5, 2020
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 5, 2020

This is a duplicate of an earlier bug but I'm on my phone. The HTTP server doesn't support setting the deprecated Reason-Phrase in the Status-Line. (http2 and http3 don't even have it)

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 5, 2020

(and we're unlikely to add such http1-specific support, unless you've got a great API proposal. None have appeared yet.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.