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

http.StripPrefix not properly handling wildcards with muxes #66510

Closed
S-IR opened this issue Mar 25, 2024 · 1 comment
Closed

http.StripPrefix not properly handling wildcards with muxes #66510

S-IR opened this issue Mar 25, 2024 · 1 comment

Comments

@S-IR
Copy link

S-IR commented Mar 25, 2024

Go version

go1.22.1.linux-amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/stan/.cache/go-build'
GOENV='/home/stan/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/stan/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/stan/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/linux_amd64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/stan/Documents/code/bluerpc/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build923806106=/tmp/go-build -gno-record-gcc-switches'

What did you do?

https://go.dev/play/p/R_kkd-iAPI0

What did you see happen?

If you try to create a nested http mux on a wildcard route using http.StripPrefix it will not work. In the earlier example you can see that the response is "body 404 page not found"

What did you expect to see?

I expected to see the mux handle function to go through and get "body Hello" printed

If I modify the earlier example and do a request on /{wildcard}/hello verbatim the request does go through :
https://go.dev/play/p/omUCziNc8Bo

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