How We Used Cloudflare Workers to Reverse Proxy Microtools Under One Domain

WFH AlertWFH Alert
1 min read

We’re building WFH Alert, a platform that sends out curated work-from-home jobs by email. Along the way, we’ve also been launching free tools to help with resumes, applications, and job tracking.

How we used Cloudflare Workers

Each tool is hosted separately for simplicity. But instead of subdomains or external redirects, we wanted everything to live under one clean domain like:

wfhalert.com/tools/resume-tailor/

We used Cloudflare Workers to reverse proxy requests from our main domain to where each tool is actually hosted. Here’s an example route we use in the Worker config:

Route: *.wfhalert.com/tools/resume-tailor*

This means any request to that URL pattern will get rerouted through the Worker script.

The Worker Code

addEventListener("fetch", event => {
  event.respondWith(handleRequest(event.request));
});

async function handleRequest(request) {
  let url = new URL(request.url);
  url.hostname = "your-real-host.com";
  url.protocol = "https";

  let newRequest = new Request(url, request);
  return fetch(newRequest);
}

This swap the request hostname and proxy the call to the actual tool backend.

The Result

Now we can serve our free tools under one unified domain, even though they’re hosted somewhere else. Cloudflare Workers made this painless. If you’re running a SaaS or microtools setup and want to unify everything under a single domain, it’s worth trying.

0
Subscribe to my newsletter

Read articles from WFH Alert directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

WFH Alert
WFH Alert