Skip to content

🐛 BUG: PUT request with Expect header not properly handled #7185

Open
@10io

Description

@10io

Which Cloudflare product(s) does this pertain to?

Workers Runtime, Wrangler

What version(s) of the tool(s) are you using?

3.85.0 [Wrangler]

What version of Node are you using?

10.5.0[npm], v20.12.2[Node.js]

What operating system and version are you using?

Mac Sonoma 14.7.1

Describe the Bug

Context

We are using a cloudflare worker as a proxy in front of a backend.

That backend can receive PUT requests with the Expect header set.

This is used, for example, by mvn commands when uploading files. See this section from the Maven documentation.

Observed behavior

The backend will correctly return the 100 Continue response code in order to receive the request body.

It seems that the worker "interprets" the 100 Continue response code as "the response has been sent". Thus, trying to read the request body after that ends up in an error (the backend will hit an unexpected EOF).

Expected behavior

The 100 Continue response code should not be considered as "the response has been sent" as the client will follow up with the request body.

Steps to reproduce

Follow the steps that are described in: https://github.com/10io/wrangler-expect-header.

Please provide a link to a minimal reproduction

https://github.com/10io/wrangler-expect-header

Please provide any relevant error logs

[wrangler:inf] PUT /dummy.txt 503 Service Unavailable (2ms)
✘ [ERROR] Uncaught (async) TypeError: Can't read from request stream after responding with an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions