r/CloudFlare • • 2h ago

Discussion Building a Worker to Auto-Detect and Block Bot Attacks on a Woo Site

1 Upvotes

We see a lot of bots hitting our clients' sites, so I got to thinking, what about setting up a CF Worker to automate things? The one site I want to do this on is a Woo site on Kinsta and they have their own Cloudflare Pro. This site gets hit constantly and I'm tired of playing whack-a-mole by hand. Over the last few months we've dealt with:

  • Card testing on checkout / Store API
  • SQLi scans on search
  • Spam account registrations and comment/review spam
  • Crawlers hammering faceted filters (filter_, min_price, etc.)
  • A bot using the host's temp domain to bypass CF entirely (since closed)

Today, twice in 12 hours, a PDP flood from ~900 rotating residential IPs using Google Shopping srsltid params with a spoofed same-site referrer. PDPs aren't cached (client needs instant stock), so it maxed out PHP and took the site down

Current setup is 12/20 custom rules and 2/2 rate limit rules (maxed on Pro). I have rules for card testing, SQLi, XML-RPC, filter crawling, ASN/VPN challenges on checkout, AI crawlers, and a catch-all bot block rule. Can't use Super Bot Fight Mode because it breaks ShipStation and other webhooks/API traffic, even with allow rules.

Problem is every new attack means me finding it in the logs after the fact and hand-writing a new condition.

My Plan is a Worker on a 5 min Cron that

  1. Pulls the last 5 min of traffic from the GraphQL analytics API
  2. Looks for patterns across the whole site, not just one attack type: request spikes by ASN, UA, path, query pattern, referrer, POSTs to checkout/login/register, etc.
  3. When something crosses a threshold, writes it into the existing catch-all block rule via the Rulesets API (no new rules, no IPs since they rotate)
  4. Logs each entry in KV with an expiry so it drops out after X days and doesn't block real customers forever
  5. Never touches verified bots, payment/shipping webhooks or /wp-json integrations
  6. Pings me when it adds or removes something

Questions

  1. Is GraphQL analytics on Pro enough for this or will I hit limits on breakdowns/lookback?
  2. Better signals than ASN/UA/path that are available on Pro? (I know JA4 is Bot Management only)
  3. Anything built into CF I'm overlooking that would do this without a Worker?
  4. Anyone already doing something like this, and what bit you?

Am I missing anything here? Solid?


r/CloudFlare • • 3h ago

Email Service Is Not For Sending Personal/Business Email

29 Upvotes

With all the posts recently on replacing Gmail or moving Email to Cloudflare, you can tell people aren't reading the docs. Email Service is for sending transactional email only. It also must comply with applicable anti-spam laws and regulations to maintain good standing and deliverability including

  • CAN-SPAM Act (United States)
  • GDPR (European Union)
  • CASL (Canada)
  • Include proper unsubscribe mechanisms
  • Honor opt-out requests promptly

https://developers.cloudflare.com/email-service/

https://developers.cloudflare.com/email-service/platform/limits/


r/CloudFlare • • 6h ago

Open-sourced a personal webmail that runs entirely on Cloudflare (Workers + Email Routing + D1 + R2)

4 Upvotes
Built this because Gmail is removing “Send as” for third-party addresses (including Cloudflare Email Routing domains) in Jan 2027.
Flaremail is a single-user personal mailbox that runs fully inside your Cloudflare account no separate mail server needed.
Uses Workers, Email Routing, Email Sending, D1, R2, Queues and Access.
Repo (still early): https://github.com/unknownhad/emailflare
Happy to hear feedback or ideas from other Cloudflare users.

r/CloudFlare • • 7h ago

Discussion What's new in GentleMail 0.9: drafts support, docked/expandable composer, like in Gmail.

1 Upvotes

GentleMail is an open-source webmail, REST API, webhooks and MCP server. It all runs as one Worker:

  • Email Routing delivers incoming mail to the Worker's email() handler. Email Service sends.
  • D1 holds mailboxes, conversations, drafts and users, in plain SQL with numbered migrations. Batches stay under D1's 100-bind limit.
  • R2 holds message bodies and attachments. A draft's files are uploaded to R2 as you attach them, and a scheduled sweep removes orphans, keeping its cursor in D1.
  • RedwoodSDK for the React server-rendered UI and server functions.
  • Everything goes through bindings, so you never give it a Cloudflare API token. You deploy it with the Deploy button or by cloning the repo into Workers Builds.

One deployment serves unlimited domains and mailboxes for the $5 Workers Paid plan. That includes 3,000 sent emails a month, then $0.35 per 1,000; incoming is unlimited.

New in 0.9: drafts saved as you type, with optimistic versioning in D1 (UPDATE … WHERE version = ? RETURNING version) so two tabs can't overwrite each other. Also a Gmail-style docked composer, and replies inside the conversation.

Also we have a discord community been setup for announcements and respond to issues you might encounter. https://discord.gg/ZBbky2Nb6

Happy to answer questions about running a mail app on Workers: limits, Email Routing quirks, D1 schema choices.

https://gentlemail.dev


r/CloudFlare • • 7h ago

Cloudflare Blog Varlock is joining Cloudflare

Thumbnail
blog.cloudflare.com
44 Upvotes

r/CloudFlare • • 11h ago

Discussion Sorry, Cloudflare. I am really so sorry.

Post image
186 Upvotes

Wish I had selected Cloudflare to register my domain.

I wake up early morning just to find a thre@t email N@mecheap sent me they're going to suspend my acc if I don't submit Photo ID and all.

If I had regtd my domain with Cloudflare, this could never have been case.

I am sorry Cloudflare. Please pardon me. Next time, I will choose and recommend only you.

Namecheap is holding my web property, not unlocking my domain, not providing me Secret Code to transfer. They are worst.


r/CloudFlare • • 15h ago

I got tired of Cloudflare's Pages Direct Upload not working in Workers, so I wrote my own client.

1 Upvotes

I needed a Worker to redeploy a Cloudflare Pages project on its own, no CI, no wrangler CLI, just a scheduled Worker pushing new files up. Cloudflare has a Direct Upload API for exactly this. The existing npm package for it does not work in Workers.

I opened it up and found fs/promises, path, and timers/promises imported at the top level. In a Worker. There's no filesystem in a Worker, so the whole thing fails to bundle. The package hasn't been touched since March 2023, so I'm guessing nobody building for Workers has needed it badly enough to fix it.

So I wrote pages-direct-upload.

What it does:

  • Runs anywhere fetch exists - Workers, Node 20+, Deno, Bun
  • Files go in as plain strings or Uint8Array, nothing touches disk
  • About 17 KB minified, 7 KB gzipped, one dependency (@noble/hashes, just for the BLAKE3 hashing)
  • Skips assets Cloudflare already has, batches and parallelizes the uploads, retries on transient failures, and refreshes the upload token if a big deploy outlives it
import { deployFiles } from "pages-direct-upload";
 
const result = await deployFiles(
  { "index.html": "<h1>hello</h1>" },
  {
    accountId: env.CF_ACCOUNT_ID,
    projectName: "my-site",
    apiToken: env.CF_API_TOKEN,
    branch: "main",
  }
);
 
console.log(result.url);

The annoying part of building this was that Cloudflare doesn't document any of these endpoints. I ended up reading wrangler's own bundled source to figure out the actual request shapes, then set up a throwaway Pages project and tested the assumptions against the live API: does it validate file hashes, does _headers work if it's dropped in the manifest versus sent as a form part, how big can one upload batch actually get before it's rejected, how long does the upload token last. Some of that didn't match what I expected going in.

Docs: https://docs.proflare.dev/npm/pages-direct-upload

One rather annoying limitation: this can't run from a browser, since Cloudflare's API doesn't send CORS headers back. You'd have to host a smol proxy in front of it for that.

If you find anything that doesn't work, plz reply to this post, or contact me from https://proflare.dev/contact


r/CloudFlare • • 18h ago

Question IP whitelisting only working on some IPs

1 Upvotes

I'm on a free account and I've set up a list of IP addresses then created a custom rule where IP Source Address is in that list that skips all other rules and checks. The list includes IPs used by an uptime status check website and 1 other IP for an AWS lightsail server.

The uptime servers have no problem accessing the site to do their checks, but the AWS server gets a challenge message. I've also tried creating an IP Access Rule for the AWS server, but that didn't work either.

When I look at the Events tab under Analytics I see tons of entries for the uptime IPs with an action type of Skip as expected. But when I search for the AWS IP there are no events.

I've tested this by sending a simple curl GET request from the AWS server to the domain running through Cloudflare. I've confirmed the IP of the server multiple ways including by running that same curl request against another domain that isn't using Cloudflare and checking the nginx logs.

I'm officially at a loss for how this could be possible with 1 rule and 1 list of IPs where they all work except 1. The only explanation I see is some kind of special rules for AWS servers that override user rules. Is that possible or is there something else I'm missing here?


r/CloudFlare • • 20h ago

Cannot upload pages

2 Upvotes

I am new to all this sorry for being kinda dumb , i am trying to upload a static page , i paste the zip file containing the index.html and yet it says worker not page and so it shows only a blank white page can anyone help?


r/CloudFlare • • 21h ago

Question Anyone know how to bypass this

Post image
0 Upvotes

i tried vpn this is a indian website i am not in india right now


r/CloudFlare • • 21h ago

Gmail "ส่งอีเมลเป็น" จะสิ้นสุดในเดือนมกราคม 2027. มีแผนยังไง?

Thumbnail reddit.com
0 Upvotes

r/CloudFlare • • 23h ago

Question can cloudflare analytics improve page view reporting for a nonprofit?

3 Upvotes

Hi all, I'm just a simple communications manager for a tiny nonprofit and I'm absolutely tearing my hair out trying to get even vaguely accurate information on page views and I'm hoping someone can help. Apologies in advance if I come across as completely clueless, I mostly do fundraising and have no expertise in this area.

Basically, our website has a series of informational guides, and we need to report back to funders with how many times those guides were looked at. We don't even need to narrow it down to how many unique visitors, just how many times a human being looked at a page with a guide on it. We're fine with counting AI agents that are giving our information to people using ChatGPT or whatever, but we've had an insane spike in views over the last two months that, as far as I can tell, is almost entirely AI crawlers.

We don't have the staff or budget to get into advanced analytics, and this is literally the only thing we need to know. We're currently using a Google Analytics account that was set up by someone whose job description was "lawyer who does data sometimes" and now it's on someone whose job description is "social media posts and event planning" (me).

We're not opposed to shelling out the $250/year for Pro if it makes getting the data we need easier and more accurate, but I'd be curious to hear from people who actually know what they're doing as to whether or not making the switch is likely to mitigate the problem.

ETA: I tried enabling bot fight and we were almost immediately de-indexed from Google. Possibly user error on my end, but 90% of our clients find us that way so leadership freaked out and we ended up switching it off (we were back in search results within a day).


r/CloudFlare • • 1d ago

Long shot

0 Upvotes

I have an ex who is a dev, and has seemingly gotten access to an important gmail account of mine. They changed the recovery email on that account to a cloudlfare email account, which I had never heard of until today. I am doing a recovery process through gmail, but am hoping to get the cloud flare account deleted if possible. Cloudflare is (as expected) quite exclusive and it's not easy to get in touch with support and reporting abuse doesn't seem to be my best option. Any tips or tricks would be much appreciated.


r/CloudFlare • • 1d ago

Question Windows shows DoH as disabled while using Cloudflare WARP

0 Upvotes

I'm new to this, so I have a question.

When I am connected to Cloudflare WARP (DNS and traffic mode), ipconfig /all doesn't indicate that DoH is enabled. However, Cloudflare's 1.1.1.1/help page reports that it is enabled.

Windows network settings also show DNS as unencrypted and DoH as disabled, although I can enable it manually.

Should I enable DoH manually in Windows settings as well or would that be redundant?


r/CloudFlare • • 1d ago

I built sigv4-lite: a 3.4kB, zero-dependency AWS SigV4 signer using only Web Crypto.

0 Upvotes

If you've ever tried to talk to AWS S3, Cloudflare R2, or Backblaze B2 from an edge runtime (Cloudflare Workers, Vercel Edge, Deno, or straight in the browser), you've probably run into the same problem.

The official `@aws-sdk/client-s3` and `@smithy/signature-v4` packages pull in huge dependency trees and often need polyfills outside Node.js. Even lighter alternatives like `aws4fetch` (~11kB) force you into an `AwsClient` wrapper instead of letting you use your own HTTP client.

So I built **`sigv4-lite`**—a **3.4kB**, zero-dependency AWS SigV4 signer built entirely on the standard Web Crypto API (`crypto.subtle`).

Instead of wrapping `fetch`, it exports two stateless functions:

* `signRequest()` — returns a plain `headers` object you can pass to `fetch`, `ky`, `ofetch`, `axios`, or whatever else.
* `presignUrl()` — returns a ready-to-use presigned URL string.

**Quick example:**

import { signRequest, presignUrl } from "sigv4-lite";

// 1. Sign a request (bring your own fetch)
const headers = await signRequest({
method: "PUT",
url: "https://cloudflarestorage.com",
body: "Hello from the edge!",
accessKeyId: process.env.R2_ACCESS_KEY_ID!,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
region: "auto",
service: "s3",
});

await fetch("https://cloudflarestorage.com", {
method: "PUT",
headers,
body: "Hello from the edge!",
});

// 2. Generate a presigned URL
const uploadUrl = await presignUrl({
method: "PUT",
url: "https://amazonaws.com",
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
region: "us-east-1",
expiresIn: 900,
});

**Install:** `npm install sigv4-lite`
**Source (~100 lines, viewable directly on npm):** https://npmjs.compackage/sigv4-lite?activeTab=code

Would love feedback if you test it with R2, MinIO, Wasabi, or other S3-compatible services!


r/CloudFlare • • 1d ago

Discussion 600gb of I/O read bytes by CloudFlare One Client(warp-svc) in few hours.

0 Upvotes

I noticed in task manager details tab that svchost (camsvc) was at like 600+ GB of I/O read bytes in just 6-7 hours of uptime, climbing nonstop at 19-22 MB/s. weird thing was cpu, ram, disk %, network all looked totally normal at 0% on the main tab.

checked everything first. windows is updated, ran dism/sfc/chkdsk, restarted system, and the CapabilityAccessManager folder is only 1.2 MB so it wasnt that db-wal bloat bug. restarting camsvc would zero it out and then a bit later it would start climbing again.

traced the rpc calls with logman to see what was actually hitting camsvc and it went:warp-svc.exe(CloudflareWARP)- WlanSvc (forcing background wifi scan every 1-4 sec) - camsvc as soon as i ran 'Stop-Service -Name CloudflareWARP', camsvc stopped climbing right away.

I was unable to that the 600+ gb one screenshot, so here is 110+ gb one in just 0:14:15 CPU time which is insane

tldr : title
anyone else seeing this? i actually want to keep warp running all the time so disabling the service isn't really what i want, is there a setting or any workaround so that it doesn't spam WlanSvc like this?


r/CloudFlare • • 1d ago

Clipstral - Mistral Multimodal Embed - When can we have it on Workers AI? Pls :)

2 Upvotes

r/CloudFlare • • 1d ago Bravo

Community I built a mailbox for my domains that runs in my own Cloudflare account

Post image
166 Upvotes

I built cloudmail to run email for my own domains. You deploy it to your Cloudflare account and get a normal inbox: send, reply, search, labels, shared inboxes.

Gmail stops "Send mail as" in January. If you forward your domain to Gmail with Email Routing, you won't be able to reply from it after that. This is what I use instead.

Mail comes in through Email Routing to a Worker. Each mailbox is a SQLite database in a Durable Object, and attachments go to R2. You send with Cloudflare Email Service, or with your own SES or Resend account.

Demo, no sign-up: https://demo.trycloudmail.com

The source is available on GitHub: https://github.com/cloudmail-hq/cloudmail

Tell me what's missing for you.


r/CloudFlare • • 1d ago

Cloudflare Blog Post-quantum cryptography is still safe

Thumbnail
blog.cloudflare.com
73 Upvotes

r/CloudFlare • • 1d ago

Discussion Workers + D1 + R2 for a small indie app: when would you choose a VPS instead?

8 Upvotes

For a small indie product, my starting preference is managed infrastructure: less time configuring servers, more time testing whether anyone wants the product. Cloudflare's Workers + D1 + R2 combination looks appealing for that: frontend and APIs, SQL data, and uploaded files in one stack. The free tiers help with early validation, but they aren't unlimited. Workers has request and CPU limits; D1 has query and storage limits; R2 has storage and operation costs even though egress is free. What I'm interested in is where this stops being a sensible default. For those who have shipped on this stack, what pushed you toward a VPS or another managed backend: CPU-heavy work, database query patterns, background jobs, portability, or something else? My instinct is to optimize for fewer infrastructure chores before the first paying customer, then revisit the architecture based on actual usage. Which tradeoff would you make differently?


r/CloudFlare • • 2d ago

Discussion Tested Clef, Clef-flash and two Llama models for contact form spam on Workers AI

Thumbnail
gallery
0 Upvotes

I've been using Clef-flash for spam filtering in Formkove, a form backend I built on Workers. I wanted to see how it compares with Clef and a couple of general-purpose models.

I used 600 messages written and labelled by Claude, 360 spam and 240 legitimate, across four types of businesses. Each model got three runs with a spam threshold of 0.7 and the purpose of the form included in the request.

ModelSpam caughtLegit heldp95 latencyCost/1k checks
Clef-flash90.3%0/240142 ms$0.011
Clef95.9%1/240315 ms$0.069
Llama 3.3 70B95.3%2/2402,193 ms$0.094
Llama 3.1 8B93.9%16/240332 ms$0.016

Results are averaged across three runs, with latency measured separately inside a Worker in YYZ. Costs are estimated from token usage, excluding the free allowance.

I ended up sticking with Clef-flash. It caught less spam than the other models, but it was faster, cheaper and didn't flag any of the 240 legitimate messages as spam.

One thing I found with Clef-flash is that raising the threshold to 0.9 dropped spam detection to 50%. Even at 0.7, it struggled with phishing messages disguised as follow-ups.

I'd like to see how these results compare with real traffic since my dataset is synthetic. Has anyone else been using Clef for spam filtering?

Full write-up with the dataset and charts: https://formkove.com/blog/clef-spam-filter/


r/CloudFlare • • 2d ago

An Effect v4 BFF on Workers: sealed OAuth sessions, ETag compare-and-swap on Drive, and proxied bodies that never hit the heap

2 Upvotes

I run a self-hosted notes app on a Worker and the interesting problems were all in the BFF, so here are the three that shaped it. Code is MIT if you want to read it: https://github.com/giovacalle/markyard, under bff/ and docs/adr/.

OAuth tokens never reach the browser. Sessions are AES-256-GCM sealed HttpOnly __Host- cookies, and the Worker holds the Google access and refresh tokens while proxying Drive calls. The app therefore needs no token in JS, which is what lets the frontend run under default-src 'self' with no nonces and nothing inline. A stolen XSS payload is worth a lot less when there is no token in reach.

Saves are compare-and-swap, and the precondition belongs to the backend. Drive v3 has no If-Match, so the save path uses v2 with If-Match on the file etag: read the etag, PATCH with If-Match, and a 412 means someone else wrote, so return the conflict and let the client merge. Doing it server side covers the other writers instead of racing them: Drive for desktop, Google's own .md editor and a plain v3 upload all move the etag. The known hole is that the etag tracks modifiedTime, so a writer that preserves it (rclone copying source timestamps) can still slip a change through; md5Checksum and version move in that case, but checking them is a read before the write, not a precondition.

Byte proxies should not touch the JS heap. Images and downloads stream Drive's response body straight through as a new ReadableStream, no arrayBuffer(), no new Response(await res.blob()). On Workers that is the difference between working and failing to allocate once the files get big.

The framework choice: the BFF is TypeScript with Effect v4, deployed with Alchemy. Structured concurrency and typed errors made the token refresh and retry paths readable, and it runs on the Workers runtime with no node: imports. That constraint is enforced in CI, next to a style= scanner that keeps the CSP clean.

Optional state sync (settings, last opened note) is duck-typed against D1: bind STATE_DB and it works, leave it unbound and the feature turns itself off, so the same code deploys stateless.

Happy to answer anything about this shape of deployment, the Drive quirks, or what Effect v4 costs in bundle size and cold start, though on the last one I only have my own numbers and they are not the interesting kind of benchmark.


r/CloudFlare • • 3d ago

Resource Stripe cancel webhook on Workers: two events into one email, WebCrypto signature check, cron delay

1 Upvotes

I put together a small Worker that sends a follow-up email when someone cancels a Stripe subscription. A few things about the Workers side that might save someone time:

  • Signature check without the Stripe SDK. HMAC-SHA256 over timestamp.rawBody with crypto.subtle, constant-time compare against the v1 values, 300 second tolerance. Read the body with request.text() before anything parses it.
  • Two events for one cancellation. Cancel at period end sends customer.subscription.updated (watch previous_attributes.cancel_at_period_end going false to true) and later customer.subscription.deleted. I key both on the subscription id in a Durable Object (SQLite storage) so it sends once. Stripe retries are covered by the same check.
  • Delay without Queues. The webhook stores a send_at and returns 200. A cron trigger every minute sends whatever is due. Setting the delay to 0 sends inside the request.
  • Store as little as possible. Only ids, email and status in the DO. Plan and cancel reason are read from the Stripe API at send time.
  • Deploy button. Secrets are prompted from .dev.vars.example. The one awkward bit is that the Stripe signing secret only exists after you have the worker URL, so the README says to paste a placeholder first and set it with wrangler secret put after.

The email links to a voice interview in Frank, which is the product I work on, but the webhook part is generic and MIT licensed. Happy to hear if there is a cleaner way to do the delay than a per-minute cron.


r/CloudFlare • • 3d ago

Made a saas product running completely on cloudflare stack :)

Post image
9 Upvotes

Auth is done through betterauth, db is d1, serverless backend on worker, client bundle on cf pages, and workers ai for ai image edits

Thanks cloudflare.

pixalgo.app