Cloudflare Workers

Outbound HTTP from Cloudflare Workers through one relay

Workers run user-triggered code at the edge with the ability to fetch almost anything. Backfire puts a validating relay between the worker and the Internet, and gives you a log that survives past the request.

What to expect

  • Plain fetch() from the worker to the relay — no bindings, no compatibility flags.
  • Store the key as a Workers secret; rotate it in the dashboard whenever you like.
  • Target validation happens on the relay, so Worker code stays small.
  • Responses come back in one envelope shape regardless of the upstream content type.

Working example

cloudflare-workers
export default {
  async fetch(request, env) {
    const target = new URL(request.url).searchParams.get('u');
    const upstream = await fetch('https://backfireapi.base44.app/functions/forward', {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${env.BACKFIRE_KEY}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ url: target, method: 'GET', timeout_ms: 8000 }),
    });

    const envelope = await upstream.json();
    return Response.json(envelope, { status: envelope.ok ? 200 : 502 });
  },
};

Other environments

Questions about this

Keep reading

Try it with 5,000 free trips.

No card, no subscription, and the balance never expires.