You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pentesting-ci-cd/cloudflare-security/cloudflare-workers-pass-through-proxy-ip-rotation.md
+17-27Lines changed: 17 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,21 @@
4
4
5
5
Cloudflare Workers can be deployed as transparent HTTP pass-through proxies where the upstream target URL is supplied by the client. Requests egress from Cloudflare's network so the target observes Cloudflare IPs instead of the client's. This mirrors the well-known FireProx technique on AWS API Gateway, but uses Cloudflare Workers.
6
6
7
-
Key capabilities:
7
+
### Key capabilities
8
8
- Support for all HTTP methods (GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD)
9
9
- Target can be supplied via query parameter (?url=...), a header (X-Target-URL), or even encoded in the path (e.g., /https://target)
10
10
- Headers and body are proxied through with hop-by-hop/header filtering as needed
11
11
- Responses are relayed back, preserving status code and most headers
12
12
- Optional spoofing of X-Forwarded-For (if the Worker sets it from a user-controlled header)
13
13
- Extremely fast/easy rotation by deploying multiple Worker endpoints and fanning out requests
14
14
15
-
How it works (flow):
16
-
1) Client sends an HTTP request to a Worker URL (<name>.<account>.workers.dev or a custom domain route).
15
+
### How it works (flow)
16
+
1) Client sends an HTTP request to a Worker URL (`<name>.<account>.workers.dev` or a custom domain route).
17
17
2) Worker extracts the target from either a query parameter (?url=...), the X-Target-URL header, or a path segment if implemented.
18
18
3) Worker forwards the incoming method, headers, and body to the specified upstream URL (filtering problematic headers).
19
19
4) Upstream response is streamed back to the client through Cloudflare; the origin sees Cloudflare egress IPs.
20
20
21
-
Worker implementation example
21
+
### Worker implementation example
22
22
- Reads target URL from query param, header, or path
23
23
- Copies a safe subset of headers and forwards the original method/body
24
24
- Optionally sets X-Forwarded-For using a user-controlled header (X-My-X-Forwarded-For) or a random IP
### Automating deployment and rotation with FlareProx
139
+
139
140
FlareProx is a Python tool that uses the Cloudflare API to deploy many Worker endpoints and rotate across them. This provides FireProx-like IP rotation from Cloudflare’s network.
Use the FlareProx library to create/list/test endpoints and route requests from Python.
220
224
221
225
<details>
@@ -274,30 +278,16 @@ except Exception as e:
274
278
275
279
</details>
276
280
277
-
Burp/Scanner integration
281
+
**Burp/Scanner integration**
278
282
- Point tooling (for example, Burp Suite) at the Worker URL.
279
283
- Supply the real upstream using ?url= or X-Target-URL.
280
284
- HTTP semantics (methods/headers/body) are preserved while masking your source IP behind Cloudflare.
281
285
282
-
Operational notes and limits
286
+
**Operational notes and limits**
283
287
- Cloudflare Workers Free plan allows roughly 100,000 requests/day per account; use multiple endpoints to distribute traffic if needed.
284
288
- Workers run on Cloudflare’s network; many targets will only see Cloudflare IPs/ASN, which can bypass naive IP allow/deny lists or geo heuristics.
285
289
- Use responsibly and only with authorization. Respect ToS and robots.txt.
286
290
287
-
Detection and mitigation (defender notes)
288
-
If your application is the target and you wish to prevent access via generic Cloudflare-originated proxies (Workers, other Cloudflare egress):
289
-
- Do not rely solely on IP allow/deny lists; Cloudflare Workers share Cloudflare IP space and ASN (AS13335). Blocking all Cloudflare IPs is often impractical.
290
-
- Require strong request authentication at the application layer (tokens, HMAC-signed headers, mTLS, per-client API keys), and validate them server-side.
291
-
- For Cloudflare-protected origins you control, consider:
292
-
- Authenticated Origin Pulls or mTLS between Cloudflare and origin so only your own zone can reach the origin.
293
-
- WAF/Firewall Rules that require a secret header or signed token and block requests missing them.
294
-
- API Shield (schema validation, mTLS, JWT validation) and Bot Fight Mode/Super Bot Fight Mode to reduce automated abuse.
295
-
- Rate limiting by path/user token; challenge or block requests lacking expected cookies/headers from your first-party app flows.
296
-
- Monitor for anomalies: unusual user agents, inconsistent headers, rapidly shifting Cloudflare IPs, or requests to endpoints that should only be hit by your front-end.
297
-
298
-
Related techniques
299
-
- FireProx (AWS API Gateway) pioneered pass-through proxying for IP rotation and header control; Workers provide a similar pattern with Cloudflare egress.
0 commit comments