Redirects are often more complicated than: ''Send traffic to this URL over to this other URL.'' You often need business logic to make routing decisions for site migrations, promotional campaigns, and loyalty programs.
For example: Let’s assume the old site used a product sku in product-related URLs, but a revamped, new site uses a “tag” for SEO purposes.
Old url: www.example.com/sku/{product_sku}/*
New url: www.example.com/products/{product_tag}/*
E.g., sku is 483D5F; tag denotes straight-fit-denim-jeans
Old “reviews” url: www.example.com/sku/483D5F/reviews
New “reviews” url: www.example.com/products/straight-fit-denim-jeans/reviews
Loading...
https://www.edgecompute.live/sku/483D5F/reviews
Copied to clipboard!
Note the URL path changing from /sku/483D5F/reviews to products/straight-fit-denim-jeans/reviews
This example uses EdgeWorkers + EdgeKV to extract a query string product SKU from an incoming URL, match it against a SKU stored in a KV database, and properly redirect the browser to the new product page.
Distributed Data
Pushing data to the edge speeds up websites by avoiding central bottlenecks.
Ease Development
Enable developers to modify application behavior without touching origin server logic.
Improve Reliability
Move compute cycles to the edge, reducing load and improving reliability and performance of origin servers.
Reduce Latency
Speed up response times by moving work closer to users.
Related Examples
View MoreA/B Testing
Randomly assigns a new user to a group for A/B testing. The assignment is stored in a cookie and passed to the origin in a query parameter. The A/B group can be forced via a query string parameter for easy testing. The group names, percentage split, cookie name, and query parameter name are configured through constants in the EdgeWorker JavaScript module.
Conference/Meeting Details
Implements a Conference Attendance Code API call that returns the meeting details of a conference as HTML if the user provides the correct code. With abc123 in the key GET parameter, the user is shown conference details. If the parameter is incorrect, an error is returned, keeping the information away from the browser to maintain confidentiality.