You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a PDS behind some proxies (in this instance, a Cloudflare tunnel) any POST without a body fails with, "A request body was provided when none was expected". This is because the proxy sets a "Transfer-Encoding: Chunked" header even when no body is sent.
Arguably this is a bug in the proxy, but the getBodyPresence distinguishes between "no body" and "empty body" when the only thing that actually matters to the validator function is whether a body is present and non-zero length or absent/empty. The validateInput reads the body anyway, so it might be more robust to wait until after it reads the body and then just asserts that the body is present and non-zero length if one is expected and vice-versa.
I may be able to make a PR for this if welcome.
To Reproduce
Steps to reproduce the behavior:
Run a PDS instance behind a Cloudflare tunnel
Log in with a client and make a request with no body, eg. request an email confirmation token.
Observe that the request is rejected with the above error.
Expected behavior
The request succeeds as normal.
Details
Operating system: Ubuntu 24.04.1 LTS
Node version: 20.11.1 (official PDS docker image)
Additional context
A workaround to this particular failure is to disable chunked transfer encoding in the cloudflare tunnel options.
The text was updated successfully, but these errors were encountered:
Describe the bug
When running a PDS behind some proxies (in this instance, a Cloudflare tunnel) any POST without a body fails with, "A request body was provided when none was expected". This is because the proxy sets a "Transfer-Encoding: Chunked" header even when no body is sent.
Arguably this is a bug in the proxy, but the
getBodyPresence
distinguishes between "no body" and "empty body" when the only thing that actually matters to the validator function is whether a body is present and non-zero length or absent/empty. ThevalidateInput
reads the body anyway, so it might be more robust to wait until after it reads the body and then just asserts that the body is present and non-zero length if one is expected and vice-versa.I may be able to make a PR for this if welcome.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The request succeeds as normal.
Details
Additional context
A workaround to this particular failure is to disable chunked transfer encoding in the cloudflare tunnel options.
The text was updated successfully, but these errors were encountered: