Skip to content

Explicit regional placement disables WebSocket permessage-deflate while Smart Placement works #6671

@redsquare

Description

@redsquare

Which Cloudflare product(s) does this pertain to?

Workers Runtime

What versions & operating system are you using?

  • Wrangler: 4.85.1
  • OS: Linux

Please provide a link to a minimal reproduction

I can provide a stripped repro if needed, but the key finding is that the only variable required to trigger this is Worker placement mode.

I reproduced it with:

  • the stock Cloudflare Agents starter
  • our real Worker app (aidan-agent)

Describe the bug

WebSocket permessage-deflate negotiation works normally when a Worker has either:

  • no placement configured, or
  • Smart Placement enabled with:
"placement": { "mode": "smart" }

But if I switch the Worker to an explicit regional placement pin:

"placement": { "region": "aws:eu-west-2" }

then the WebSocket upgrade still succeeds with 101 Switching Protocols, but Sec-WebSocket-Extensions disappears from the response.

So this is not a generic websocket compression failure. It appears to be specifically tied to explicit regional placement.

Exact observed behaviour

No placement configured

  • 101 Switching Protocols
  • Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits=15

Smart Placement

  • 101 Switching Protocols
  • Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits=15

Explicit regional placement (aws:eu-west-2)

  • 101 Switching Protocols
  • Sec-WebSocket-Extensions header missing

Steps to reproduce

  1. Deploy a Worker that upgrades a request to a WebSocket.
  2. Probe the same WebSocket endpoint with a request offering permessage-deflate.
  3. Confirm that compression is negotiated when:
    • placement is omitted, and
    • placement.mode = "smart"
  4. Change only the placement config to:
"placement": { "region": "aws:eu-west-2" }
  1. Redeploy.
  2. Probe the same endpoint again.
  3. Observe that the upgrade still returns 101, but Sec-WebSocket-Extensions is no longer present.

Expected behaviour

If the runtime supports websocket compression for this Worker, changing placement mode should not silently disable permessage-deflate negotiation.

Actual behaviour

An explicit region pin appears to disable websocket compression negotiation, while Smart Placement and no placement do not.

Extra context

  • I originally discussed this with Sunil Pai on Discord, so cc @threepointone.
  • There is already a broader issue about permessage-deflate not being accepted in some cases, but this report is narrower: the trigger here is specifically the explicit placement pin.
  • As a workaround, we switched our production path to Smart Placement and compression immediately came back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions