@@ -127,16 +127,68 @@ Restrict user access to only the specific sites or applications configured in yo
127127
128128### 1. Allow HTTP and HTTPS traffic
129129
130+ <Tabs syncKey = " dashPlusAPI" > <TabItem label = " Dashboard" >
131+
130132| Selector | Operator | Value | Logic | Action |
131133| ----------------- | -------- | ----------- | ----- | ------ |
132134| Detected Protocol | is | _ TLS_ | And | Allow |
133135| Destination Port | in | ` 80 ` , ` 443 ` | | |
134136
137+ </TabItem >
138+
139+ <TabItem label = " API" >
140+
141+ ``` sh
142+ curl https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rule\
143+ --header " Content-Type: application/json" \
144+ --header " Authorization: Bearer <API_TOKEN>" \
145+ --data ' {
146+ "name": "Allow HTTP and HTTPS traffic",
147+ "description": "Restrict traffic to HTTP and HTTPS traffic",
148+ "enabled": true,
149+ "action": "allow",
150+ "filters": [
151+ "l4"
152+ ],
153+ "traffic": "net.detected_protocol == \"tls\" and net.dst.port in {80 443}",
154+ "identity": "",
155+ "device_posture": ""
156+ }'
157+ ```
158+
159+ </TabItem > </Tabs >
160+
135161### 2. Block all other traffic
136162
163+ <Tabs syncKey = " dashPlusAPI" > <TabItem label = " Dashboard" >
164+
137165| Selector | Operator | Value | Action |
138166| -------- | -------- | ------------ | ------ |
139- | Protocol | in | _ UDP_ , _ TCP_ | Block |
167+ | Protocol | in | _ TCP_ , _ UDP_ | Block |
168+
169+ </TabItem >
170+
171+ <TabItem label = " API" >
172+
173+ ``` sh
174+ curl https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rule\
175+ --header " Content-Type: application/json" \
176+ --header " Authorization: Bearer <API_TOKEN>" \
177+ --data ' {
178+ "name": "Block all other traffic",
179+ "description": "Block all other traffic that is not HTTP or HTTPS",
180+ "enabled": true,
181+ "action": "block",
182+ "filters": [
183+ "l4"
184+ ],
185+ "traffic": "net.protocol in {\"tcp\" \"udp\"}",
186+ "identity": "",
187+ "device_posture": ""
188+ }'
189+ ```
190+
191+ </TabItem > </Tabs >
140192
141193## Restrict access to private networks
142194
0 commit comments