Where are my Cloudflare Email Workers running?
If you're curious to see where your Cloudflare Email Workers are running, the answer is surprisingly simple to figure out.
export default {
async email(email_message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext) {
const fetch_trace_prom = fetch("https://1.1.1.1/cdn-cgi/trace");
const fetch_trace_text_prom = fetch_trace_prom.then((res) => res.text());
const fetch_trace_log_prom = fetch_trace_text_prom.then((text) => {
console.debug(`Fetch trace log:\n${text}`);
});
ctx.waitUntil(fetch_trace_log_prom);
// Do your other email processing here
}
}
That's it! Now, when you look at your logs, you should see something like this:
Fetch trace log:
fl=731f48
h=1.1.1.1
ip=2a06:98c0:3600::103
ts=1746740615.82
visit_scheme=https
uag=
colo=SEA
sliver=none
http=http/1.1
loc=US
tls=off
sni=off
warp=off
gateway=off
rbi=off
kex=none
(It's entertaining to see we're "connecting" over IPv6 to a IPv4 address.)