Skip to content

Commit bcab4de

Browse files
authored
[Gateway] WebSocket page --> common policy (#23944)
1 parent 8ba048f commit bcab4de

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

public/__redirects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,6 +2142,7 @@
21422142
/cloudflare-one/policies/filtering/enforce-sessions/ /cloudflare-one/connections/connect-devices/warp/configure-warp/warp-sessions/ 301
21432143
/cloudflare-one/policies/zero-trust/policy-management/ /cloudflare-one/policies/access/policy-management/ 301
21442144
/cloudflare-one/policies/filtering/dns-policies-builder/ /cloudflare-one/policies/gateway/dns-policies/ 301
2145+
/cloudflare-one/policies/gateway/http-policies/websocket/ /cloudflare-one/policies/gateway/http-policies/common-policies/#filter-websocket-traffic 301
21452146
/cloudflare-one/cloudflare-teams-roles-permissions/ /cloudflare-one/roles-permissions/ 301
21462147
/cloudflare-one/technical-limitations/ /cloudflare-one/account-limits/ 301
21472148
/support/traffic/argo-tunnel/ /cloudflare-one/connections/connect-networks/ 301

src/content/docs/cloudflare-one/policies/gateway/http-policies/common-policies.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,3 +415,37 @@ curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rule \
415415
```
416416

417417
</TabItem> </Tabs>
418+
419+
## Filter WebSocket traffic
420+
421+
Gateway does not inspect or log [WebSocket](https://datatracker.ietf.org/doc/html/rfc6455) traffic. Instead, Gateway will only log the HTTP details used to make the WebSocket connection, as well as [network session information](/logs/logpush/logpush-job/datasets/account/zero_trust_network_sessions/). To filter your WebSocket traffic, create a policy with the `101` HTTP response code.
422+
423+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
424+
425+
| Selector | Operator | Value | Action |
426+
| ------------- | -------- | ------------------------- | ------ |
427+
| HTTP Response | is | _101 SWITCHING_PROTOCOLS_ | Allow |
428+
429+
</TabItem>
430+
431+
<TabItem label="API">
432+
433+
```bash
434+
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rule \
435+
--header "Content-Type: application/json" \
436+
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
437+
--data '{
438+
"name": "Filter WebSocket",
439+
"description": "Filter WebSocket traffic with HTTP response code 101",
440+
"enabled": true,
441+
"action": "allow",
442+
"filters": [
443+
"http"
444+
],
445+
"traffic": "http.response.status_code == 101",
446+
"identity": "",
447+
"device_posture": ""
448+
}'
449+
```
450+
451+
</TabItem> </Tabs>

src/content/docs/cloudflare-one/policies/gateway/http-policies/websocket.mdx

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)