In November 2024, CloudFront Functions introduced origin modifications, allowing you to conditionally change origin servers on each request. Starting today, you can now use this capability with VPC Origins and origin groups, enabling you to create even more sophisticated routing policies for your applications delivered from CloudFront.
You can now create dynamic routing policies that direct individual requests between any origin, including VPC Origins, by simply providing the ID for the origin. For example, you can automatically route each request to different applications by creating weights to send a certain percentage of traffic to multiple backend services, all without updating your distribution configuration. You can also create new origin groups dynamically, with the ability to set multiple origins with failover criteria. For example, you can create custom failover logic to update the primary and failover origins based on viewer location or request headers to ensure viewers have the lowest possible latency.
These features are now available within CloudFront Functions at no additional charge. For more information, see the CloudFront Developer Guide
. For examples of how to use origin modification, see our GitHub examples repository
.