We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
here we read the header directly without verifying if it exists yet first. this causes the request to blow up and 502 if its behind an LB,
➜ curl -i https://mockpi.fly.dev HTTP/2 502 server: Fly/55f8eaa0 (2023-10-09) via: 2 fly.io fly-request-id: 01HDF07QYT6S44KJKSAJ6DPEE2-sea date: Mon, 23 Oct 2023 19:29:53 GMT
and the error itself,
➜ go run main.go Listening on :8080... 2023/10/23 13:57:27 http: panic serving 127.0.0.1:56990: runtime error: index out of range [0] with length 0 goroutine 4 [running]: net/http.(*conn).serve.func1() /nix/store/s1xk6hrfn0kw8ycvqbx4vv4gr00k6qpl-go-1.21.1/share/go/src/net/http/server.go:1868 +0xb0 panic({0x1025eb040?, 0x1400001a300?}) /nix/store/s1xk6hrfn0kw8ycvqbx4vv4gr00k6qpl-go-1.21.1/share/go/src/runtime/panic.go:920 +0x26c main.handler({0x102607bc0, 0x14000152000}, 0x14000130100) /Users/nate/code/mockpi/main.go:37 +0x240 net/http.HandlerFunc.ServeHTTP(0x14000149b08?, {0x102607bc0?, 0x14000152000?}, 0x1024fdb48?) /nix/store/s1xk6hrfn0kw8ycvqbx4vv4gr00k6qpl-go-1.21.1/share/go/src/net/http/server.go:2136 +0x38 net/http.(*ServeMux).ServeHTTP(0x1027c63a0?, {0x102607bc0, 0x14000152000}, 0x14000130100) /nix/store/s1xk6hrfn0kw8ycvqbx4vv4gr00k6qpl-go-1.21.1/share/go/src/net/http/server.go:2514 +0x144 net/http.serverHandler.ServeHTTP({0x1400007ec30?}, {0x102607bc0?, 0x14000152000?}, 0x6?) /nix/store/s1xk6hrfn0kw8ycvqbx4vv4gr00k6qpl-go-1.21.1/share/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x14000140000, {0x1026083f8, 0x1400007eb40}) /nix/store/s1xk6hrfn0kw8ycvqbx4vv4gr00k6qpl-go-1.21.1/share/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 1 /nix/store/s1xk6hrfn0kw8ycvqbx4vv4gr00k6qpl-go-1.21.1/share/go/src/net/http/server.go:3086 +0x4cc
we should check for the presence of the header first and return a 400 Bad Request when it's missing instead
400 Bad Request
The text was updated successfully, but these errors were encountered:
fixed in #15
Sorry, something went wrong.
No branches or pull requests
here we read the header directly without verifying if it exists yet first. this causes the request to blow up and 502 if its behind an LB,
and the error itself,
we should check for the presence of the header first and return a
400 Bad Request
when it's missing insteadThe text was updated successfully, but these errors were encountered: