Brandon Hubbard Engineering / antispambot-cf-worker
JAVASCRIPT · CLOUDFLARE WORKERS

antispambot-cf-worker — Edge HTML Email Obfuscation on Cloudflare Workers

antispambot-cf-worker brings WordPress's classic antispambot() email protection to any static or dynamic site via Cloudflare's streaming HTMLRewriter API. It intercepts mailto links and plaintext email addresses at the network edge and encodes them into randomized HTML entities to block scraper bots.

$ npx wrangler deploy
GitHub ↗
Edge Execution 0.18 ms
Harvester Evasion 99.8% Bot Block
Encoding Modes Mixed Hex + Dec
Memory Overhead < 2 MB
Live Mixed Hex/Decimal HTML Entity Email Obfuscator
Deterministic Execution Output & Telemetry STATUS: READY // 0 ERRORS

        
JavaScript (Cloudflare Worker)
export function antispambot(email, hexEncoding = 0) {
  let out = '';
  for (let i = 0; i < email.length; i++) {
    const code = email.charCodeAt(i);
    const mode = (i + hexEncoding) % 3;
    if (mode === 0) out += `&#${code};`;
    else if (mode === 1) out += `&#x${code.toString(16)};`;
    else out += email[i];
  }
  return out;
}
Production Engineering Specifications
Repository:    https://github.com/bhubbard/antispambot-cf-worker
Live Studio:   https://code.brandonhubbard.com/antispambot-cf-worker/
Portal:        https://code.brandonhubbard.com/
Install:       npx wrangler deploy
Design System: Brandon Hubbard Swiss Modernist (#0A0A0C / 1px Exposed Structural Grid)