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
- Deploy a Worker that upgrades a request to a WebSocket.
- Probe the same WebSocket endpoint with a request offering
permessage-deflate.
- Confirm that compression is negotiated when:
placement is omitted, and
placement.mode = "smart"
- Change only the placement config to:
"placement": { "region": "aws:eu-west-2" }
- Redeploy.
- Probe the same endpoint again.
- 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.
Which Cloudflare product(s) does this pertain to?
Workers Runtime
What versions & operating system are you using?
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:
aidan-agent)Describe the bug
WebSocket
permessage-deflatenegotiation works normally when a Worker has either:placementconfigured, orBut if I switch the Worker to an explicit regional placement pin:
then the WebSocket upgrade still succeeds with
101 Switching Protocols, butSec-WebSocket-Extensionsdisappears 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 ProtocolsSec-WebSocket-Extensions: permessage-deflate; client_max_window_bits=15Smart Placement
101 Switching ProtocolsSec-WebSocket-Extensions: permessage-deflate; client_max_window_bits=15Explicit regional placement (
aws:eu-west-2)101 Switching ProtocolsSec-WebSocket-Extensionsheader missingSteps to reproduce
permessage-deflate.placementis omitted, andplacement.mode = "smart"101, butSec-WebSocket-Extensionsis no longer present.Expected behaviour
If the runtime supports websocket compression for this Worker, changing placement mode should not silently disable
permessage-deflatenegotiation.Actual behaviour
An explicit region pin appears to disable websocket compression negotiation, while Smart Placement and no placement do not.
Extra context
permessage-deflatenot being accepted in some cases, but this report is narrower: the trigger here is specifically the explicit placement pin.