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: Http Server (request) is not working with enabled Proxy Protocol #64365

Closed
1 task done
HappyTobi opened this issue Nov 23, 2023 · 5 comments
Closed
1 task done

Comments

@HappyTobi
Copy link

Go version

go1.21.4

Reproducibility

  • Does this issue reproduce with the latest release?

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

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/tobi/Library/Caches/go-build'
GOENV='/Users/tobi/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/tobi/Documents/develop/opensource/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/tobi/Documents/develop/opensource/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.4/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.4/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/tobi/Documents/develop/opensource/golang-http/go.mod'
GOWORK=''
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/n0/57nz7np96f9f0sjy9f9y9bt00000gn/T/go-build948113082=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

When running a go http server, the server response of an incoming request is always HTTP 400 Bad Request when the incoming request is using the Proxy Protocol.

What did you expect to see?

The expectation is, that the response of the http server is the same for a request with and without the Proxy Protocol.
Think to pars or get something from the Proxy Protocol at the http layer is not required, that could be done with a TCP server instance, but the request should just be accepted like the rest.

What did you see instead?

The response of the request is always HTTP 400 Bad Request

HappyTobi added a commit to HappyTobi/go that referenced this issue Nov 23, 2023
@seankhliao
Copy link
Member

haproxy proxy protocol support is out of scope for net/http

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
@HappyTobi
Copy link
Author

Hi @seankhliao

My point was not to implement the complete Proxy Protocol V1 and V2 Spec.
The idea was only to enable the "net/http/request.go" part to handle incoming "HTTP/HTTPS" requests that are part of a "TCP" package that has a "Proxy Protocol".

I can also submit a PR to add that specific thing.

What do you think?

@seankhliao
Copy link
Member

it's still out of scope, proxy is not http.

@HappyTobi
Copy link
Author

@seankhliao
Thats true, but is there any idea how to handle requests that are enhanced by the Proxy Protocol?
Currently the implementation can't handle that.
The only thing that we wan't to fix is that the http service can handle that kind of requests.

The HTTP message etc is still the same.

@HappyTobi
Copy link
Author

@seankhliao
I will look into the tcp implementation to check if we can handle it there.
Thx

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

No branches or pull requests

2 participants