An open source Category Plugin for the AWS Amplify-CLI that makes it easy to deploy live and file based streaming video services and integrate them into your Amplify applications.
Describe the bug
When writing tests for CloudFormation distribution (on VOD) I encountered the following problem:
The headers defined inside the CFDistribution template:
So i dug through the documentation and found that this way of doing it (defining the forwarded headers inside of AWS::CloudFront::Distribution ForwardedValues) is deprecated as mentioned in the documentation
They recommend to create a cache policy and link the DistributionID to it
This is what the cache policy yaml file looks like:
CachePolicyConfig: # [REQUIRED] A cache policy configuration.
Comment: '' # A comment to describe the cache policy.
Name: '' # [REQUIRED] A unique name to identify the cache policy.
DefaultTTL: 0 # The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.
MaxTTL: 0 # The maximum amount of time, in seconds, that objects stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.
MinTTL: 0 # [REQUIRED] The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.
ParametersInCacheKeyAndForwardedToOrigin: # The HTTP headers, cookies, and URL query strings to include in the cache key.
EnableAcceptEncodingGzip: true # [REQUIRED] A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.
EnableAcceptEncodingBrotli: true # A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.
HeadersConfig: # [REQUIRED] An object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and automatically included in requests that CloudFront sends to the origin.
HeaderBehavior: whitelist # [REQUIRED] Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are: none, whitelist.
Headers: # Contains a list of HTTP header names.
Quantity: 3 # [REQUIRED] The number of header names in the Items list.
Items: # A list of HTTP header names.
- 'Origin'
- 'Access-Control-Request-Method'
- 'Access-Control-Request-Headers'
CookiesConfig: # [REQUIRED] An object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and automatically included in requests that CloudFront sends to the origin.
CookieBehavior: none # [REQUIRED] Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are: none, whitelist, allExcept, all.
Cookies: # Contains a list of cookie names.
Quantity: 0 # [REQUIRED] The number of cookie names in the Items list.
Items: # A list of cookie names.
- ''
QueryStringsConfig: # [REQUIRED] An object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and automatically included in requests that CloudFront sends to the origin.
QueryStringBehavior: none # [REQUIRED] Determines whether any URL query strings in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are: none, whitelist, allExcept, all.
QueryStrings: # Contains the specific query strings in viewer requests that either are or are not included in the cache key and automatically included in requests that CloudFront sends to the origin.
Quantity: 0 # [REQUIRED] The number of query string names in the Items list.
Items: # A list of query string names.
- ''
Describe the bug When writing tests for CloudFormation distribution (on VOD) I encountered the following problem: The headers defined inside the CFDistribution template:
Are not forwarded as expected.
So i dug through the documentation and found that this way of doing it (defining the forwarded headers inside of AWS::CloudFront::Distribution ForwardedValues) is deprecated as mentioned in the documentation
They recommend to create a cache policy and link the DistributionID to it This is what the cache policy yaml file looks like:
To create a cache policy see Creating cache policies (AWS CLI)