Fast, secure URL redirect service and QR code generator built on Cloudflare Workers.
Try it live: isqr.me/edgelink
Deploy your own instance in minutes with this template repository.
- Minimal JavaScript - HTML forms use native POST/redirect; JavaScript only for copy-to-clipboard on success page
- Custom Short URLs - Optional custom names or auto-generated lowercase IDs
- QR Code Generation - SVG QR codes for every shortened URL
- Smart URL Handling - Auto-prepends https:// if protocol omitted
- Secure - Domain validation, open redirect prevention, safe header handling
- Collision-Free - Automatic ID collision detection and retry
- Edge Performance - Runs on Cloudflare's global network
- Runtime: Cloudflare Workers (Rust + WASM)
- Storage: Cloudflare KV
- Build:
worker-build - Dependencies:
worker,qrcode,serde,serde_json
-
Clone and install
git clone https://github.com/PeterMHammond/edgelink-template.git cd edgelink-template -
Deploy
wrangler deploy
The KV namespace will be automatically created on first deployment.
-
Secure with Zero Trust (Strongly Recommended)
Protect the
/createendpoint with Cloudflare Access to prevent unauthorized URL creation. Since the root path/redirects to/create, this effectively secures the entire application.Steps to configure:
- Navigate to Cloudflare dashboard → Zero Trust → Access → Applications
- Click Add an application → Select Self-hosted
- Set Application domain to your Worker domain (e.g.,
isqr.me) - Set Path to
/create - Configure Authentication method (email, Google, GitHub, SSO, etc.)
- Create an Access Policy to define who can create short URLs
- Save and deploy
Why this matters: Without Zero Trust protection, anyone can create short URLs on your domain, potentially leading to abuse or unauthorized usage.
# Run locally
wrangler dev
# Build
wrangler deploy --dry-run- Visit
/create - Enter a URL (e.g.,
cloudflare.comorhttps://cloudflare.com- https:// auto-added if omitted) - Optionally enter a custom short name (2-20 chars - auto-normalized to lowercase, spaces→hyphens)
- Get a shortened URL with QR code showing both short URL and target
- Share the short URL - redirects automatically
URL Requirements:
- Must include a domain extension (e.g.,
.com,.org,.io) - Protocol (https://) is auto-prepended if not provided
- Examples:
cloudflare.com,https://cloudflare.com/login,https://developers.cloudflare.com/index.html
Custom Name Auto-Normalization:
- Uppercase → lowercase:
MyLinkbecomesmylink - Spaces → hyphens:
my linkbecomesmy-link - Invalid characters removed:
test_123!becomestest-123
Modular design with clean separation of concerns:
src/lib.rs- Minimal router setup (16 lines)src/routes/- Individual route handlers (home→create redirect, create form/handler, redirect validator, custom 404)- Minimal JavaScript - Server-side rendering with HTML forms; JavaScript only for clipboard operations
- Security-first - URL validation, domain checking, open redirect prevention
If you're looking for an external URL shortening service, check out shorturl.com. EdgeLink is designed for those who want to host their own redirect service on Cloudflare Workers.
MIT