As reported by @TanishqSingla:
GET requests are working fine.
However POST requests that contain request body often gets stuck, I am not sure if this an issue with the client (in my case the client is discord).
After adding timeouts, I am able to not get stuck during the second request
r.Body = http.MaxBytesReader(w, r.Body, 1048576) // 1MB limit
if conn, ok := r.Body.(interface{ SetReadDeadline(t time.Time) error }); ok {
conn.SetReadDeadline(time.Now().Add(10 * time.Second))
}
body, err := io.ReadAll(r.Body)
defer r.Body.Close()
if err != nil {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("{\"status\": \"error reading body\"}"))
return
}
But this results in this error:
Location:
/Users/runner/work/kulfi/kulfi/kulfi-utils/src/peer_to_http.rs:87:5
2025-05-20T12:24:13.748938Z ERROR kulfi_utils::peer_to_http: no request
2025-05-20T12:24:13.748987Z ERROR malai::expose_http: failed to proxy http: no request
As reported by @TanishqSingla:
GETrequests are working fine.However
POSTrequests that contain request body often gets stuck, I am not sure if this an issue with the client (in my case the client is discord).After adding timeouts, I am able to not get stuck during the second request
But this results in this error: