cloudflare / cloudflare/cloudflared

Header `Content-Length: 0` not sent to origin, present on original request

Open
#544 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
15.6k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Hi,

We're running `cloudflared` and tunneling APIs thru it. Things are running smoothly in general.

But today, we have noticed a weird error on several PUT requests, it's only now that we have noticed about it.

First, we got 502 error, and we seem to receive header `Transfer-Encoding: chunked`, something that was not in the original request (this encoding is not supported by the origin). So, I have set `disableChunkedEncoding: true`.

Now the error is **411 Length Required error**. I can confirm that I do send the `Content-Length: 0` on the PUT request.

Here is the redacted output of the `cloudflared` running in debug mode:

```
2022-01-10T12:18:38Z DBG CF-RAY: 6cb5d95f9aff747c-LHR PUT http://localhost:8080/cards/toggle-contactless HTTP/2.0
2022-01-10T12:18:38Z DBG Inbound request CF-RAY=6cb5d95f9aff747c-LHR Header="map[Accept:[*/*] Accept-Encoding:[gzip] Authorization:[Bearer xxxxxxxxxxx] Cdn-Loop:[cloudflare] Cf-Connecting-Ip:[xxxxxxxxxx] Cf-Ipcountry:[GB] Cf-Ray:[6cb5d95f9aff747c-LHR] Cf-Visitor:[{\"scheme\":\"http\"}] Cf-Warp-Tag-Id:[b94c86d2-5894-492b-bd97-7a28798f5001] Content-Length:[0] Postman-Token:[f124e0b5-b210-449e-a1de-bfe6b42dadcd] User-Agent:[PostmanRuntime/7.28.4] X-Forwarded-For:[xxxxxxxxxx] X-Forwarded-Proto:[http]]" host=staging-mobile-api.xxxxxxxxx.fr path=/cards/toggle-contactless rule=0
2022-01-10T12:18:38Z DBG CF-RAY: 6cb5d95f9aff747c-LHR Request content length 0
2022-01-10T12:18:38Z DBG CF-RAY: 6cb5d95f9aff747c-LHR Status: 411 Length Required served by ingress 0
2022-01-10T12:18:38Z DBG CF-RAY: 6cb5d95f9aff747c-LHR Response Headers map[Content-Length:[0] Date:[Mon, 10 Jan 2022 12:18:38 GMT] Server:[Kestrel]]
2022-01-10T12:18:38Z DBG CF-RAY: 6cb5d95f9aff747c-LHR Response content length 0
```

I've tested the tunnel to my local machine, and see the exact request that is sent to the origin, and I conclude that `Content-Length: 0` is actually removed from the original request and never sent to the origin server. That sounds like a bug to me.

I have no idea what's going on, and with the 411 error, the API is actually never called. Anyone has any idea how to solve this? Thanks.

NOTE: We would like to keep using `disableChunkedEncoding: true` if it's possible

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.