a cloudflare worker that redirects all incoming requests to runpod.io with utm parameters. this worker is designed to handle traffic from secondary domains and redirect visitors to the main runpod website while preserving tracking information.
- node.js (v16 or higher recommended)
- pnpm
- clone the repository:
git clone https://github.com/runpod/secondary-domain-redirect
cd secondary-domain-redirect
- install dependencies:
pnpm install
start the development server:
wrangler dev
deploy to cloudflare workers:
wrangler deploy
when a visitor accesses any url on the secondary domain, the worker:
- captures the current domain from the request
- constructs a redirect url to runpod.io
- adds utm_source=secondary_domain and utm_campaign=[current domain] as query parameters
- returns a 301 redirect response
this allows for proper attribution of traffic coming from secondary domains in analytics tools.