fastify-http-proxy icon indicating copy to clipboard operation
fastify-http-proxy copied to clipboard

All DELETE requests are failling when using HTTP2

Open delucca opened this issue 2 years ago • 10 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the bug has not already been reported

Fastify version

3.x.x

Plugin version

7.1.0

Node.js version

16.x.x

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

Fedora 35

Description

When running any DELETE request without a body with HTTP2 we got the following error:

{
	"statusCode": 500,
	"code": "UND_ERR_REQ_CONTENT_LENGTH_MISMATCH",
	"error": "Internal Server Error",
	"message": "Request body length does not match content-length header"
}

If we run the same request with HTTP1, the error doesn't happen

Even if we use http2: false on the proxy options, we still got that error if the request was executed with HTTP2

Also, seems like Undici doesn't support HTTP2 yet, maybe that's the reason?

Steps to Reproduce

  1. Create a new application
  2. Add a proxy to another application that has a valid DELETE endpoint
  3. Execute a request to that DELETE endpoint using HTTP2

Expected Behavior

The request should be executed as expected

delucca avatar Jun 17 '22 21:06 delucca

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.


I'm not sure what the problem is but it would be awesome if you'd try a fix!

mcollina avatar Jun 17 '22 22:06 mcollina

@mcollina sure 😄

I was trying to debug it for a while and just stopped. Next monday I'll try to create a sample repo with it and share with you over here 😄

delucca avatar Jun 18 '22 05:06 delucca