Skip to content

Instantly share code, notes, and snippets.

export default {
async fetch(request) {
// Clone the incoming request headers to make them mutable.
const newRequestHeaders = new Headers(request.headers);
// Get the actual client IP from Cloudflare metadata
// (cf-connecting-ip is automatically provided by Cloudflare)
const clientIp = request.headers.get("cf-connecting-ip") || "";
// Define your trusted Cloudflare markers