AWS CloudFront supports using a different cloudfront function for each Behavior. For example, a user may want to have /app go to one s3 bucket and / (default path) go do a different s3 bucket, and the user may want to apply different cloudfront functions for each Origin (which are routed to via Behaviors).
Expected Behavior
By default, apply function to all behaviors (support backwards compatibility), but add a new configuration to apply a function only to a specific Behavior.
Use Case
Users may want to apply different cloudfront functions depending on which Origin is selected. For example one Origin may require appending index.html when a directory is specified, for example S3 Origin, but another may require this is not done, for example when using API Gateway as an Origin.
In the cloudfront function, conditional logic can be used to skip specific handling depending on which Origin would be selected.
Additional Context
If you deploy a cloudfront with functions and multiple origins, then you can select Behavior in the AWS console to see that an AWS user may select different cloudfront functions per Behavior.
Have a question? Please checkout our Slack Community or visit our Slack Archive.
Describe the Feature
AWS CloudFront supports using a different cloudfront function for each Behavior. For example, a user may want to have /app go to one s3 bucket and / (default path) go do a different s3 bucket, and the user may want to apply different cloudfront functions for each Origin (which are routed to via Behaviors).
Expected Behavior
By default, apply function to all behaviors (support backwards compatibility), but add a new configuration to apply a function only to a specific Behavior.
Use Case
Users may want to apply different cloudfront functions depending on which Origin is selected. For example one Origin may require appending index.html when a directory is specified, for example S3 Origin, but another may require this is not done, for example when using API Gateway as an Origin.
Describe Ideal Solution
Alternatives Considered
In the cloudfront function, conditional logic can be used to skip specific handling depending on which Origin would be selected.
Additional Context
If you deploy a cloudfront with functions and multiple origins, then you can select Behavior in the AWS console to see that an AWS user may select different cloudfront functions per Behavior.