Error "Prematurely before response header is sent" when using netcat to send http request
Describe the bug
This error is being returned instead of successfully reverse proxying when using netcat instead of curl
Pingora info
Latest commit on main, using pingora-proxy/examples/load_balancer.rs example
Steps to reproduce
# run load balancer example of the pingora-proxy
cargo run --example load_balancer
# send http request using netcat
echo -e "GET / HTTP/1.1\r\nHost: one.one.one.one\r\n\r\n" | nc 127.0.0.1 6188
Expected results
This very same netcat command works when sending requests to nginx. I was hoping Pingora would do the same.
curl http://127.0.0.1:6188 -v -H 'host: one.one.one.one'
* Trying 127.0.0.1:6188...
* Connected to 127.0.0.1 (127.0.0.1) port 6188
> GET / HTTP/1.1
> Host: one.one.one.one
> User-Agent: curl/8.6.0
> Accept: */*
>
< HTTP/1.1 200 OK
Observed results
No response received, and pingora encounters an error while proxying:
[2024-06-24T22:55:46Z ERROR pingora_proxy] Fail to proxy: Downstream ConnectionClosed context: Peer: addr: 1.1.1.1:443, scheme: HTTPS,sni: one.one.one.one, cause: context: Prematurely before response header is sent, status: 0, tries: 1, retry: false, GET /, Host: one.one.one.one
Additional context
I've attached tcpdump of both curl and netcat during this testing tcpdump_curl.txt tcpdump_netcat.txt
Related discussion https://github.com/httpwg/http-core/issues/22
Related discussion httpwg/http-core#22
discussion is already closed, can someone share what plans pingora has in this regard?