☁️ Serverless & Functions

Lambda@Edge SEO Redirect Handler

CloudFormation: Lambda@Edge function handling trailing slash normalization, www to non-www redirects, and legacy URL pattern redirects at the CloudFront layer.

Lambda@Edge SEO Redirect Handler

Clean up URL canonicalization at the CDN layer before requests reach your origin. Handles trailing slash normalization, www-to-non-www redirects, HTTP-to-HTTPS enforcement, and configurable legacy URL rewrites at CloudFront edge locations.

What's Included

  • Lambda@Edge viewer-request function (Node.js 22) with four redirect types
  • CloudFormation template (must deploy to us-east-1)
  • Configurable redirects.js rules file: exact match, prefix, and regex patterns
  • 301/302 per-rule status code support
  • Jest unit tests for every redirect type

Developer Experience

Edit the redirects.js array to add rules. Run npm test before deploying. Deploy to us-east-1 and attach to your CloudFront distribution.

What You Get

SEO-correct redirects at zero origin latency. No server-side redirect middleware needed. Returns 301s before the request reaches your application.

Requirements

AWS CLI v2, CloudFormation and Lambda permissions in us-east-1 only (Lambda@Edge constraint). An existing CloudFront distribution. Note: Lambda@Edge functions cannot use environment variables.

$9.00
  • Instant download after purchase
  • Link valid for 48 hours
  • Up to 3 downloads per license
  • Secure, private delivery
Payments secured by Stripe