Configure Host
header forwarding
By default, Amazon CloudFront does not forward the Host
header to downstream origins. However,
AWS Elemental MediaTailor requires the Host
header to function correctly. You must configure your CloudFront
distribution to forward the Host
header to MediaTailor.
Important
This configuration is critical for MediaTailor functionality. Without the Host
header,
MediaTailor cannot process requests or generate manifests with correct CDN URLs.
Methods to forward Host
header
Configure Host
header forwarding using one of these methods:
- Origin request policy (recommended)
-
Use a managed or custom origin request policy that includes the Host header.
- Legacy forwarded values
-
Configure forwarded values directly in the cache behavior. Available for existing distributions but not recommended for new ones.
Using origin request policy (recommended)
The recommended approach is to use an origin request policy that forwards the Host header:
To configure Host
header forwarding with origin request policy
-
In the CloudFront console, select your distribution.
-
Choose the Behaviors tab.
-
Select the behavior you want to modify or create a new behavior.
-
For Origin request policy, you have two options:
-
Option 1 (Recommended): Select AllViewer managed policy, which forwards all viewer headers including Host.
-
Option 2: Create a custom origin request policy that specifically includes the
Host
header:-
Choose Create policy.
-
In the Headers section, select Include the following headers.
-
Add
Host
to the list of headers. -
Also include other required headers:
User-Agent
,Accept-Encoding
, andX-Forwarded-For
. -
Save the policy and apply it to your behavior.
-
-
-
Save your changes.
Using legacy forwarded values
If you're using an existing distribution with legacy forwarded values
configuration, you can add Host
header forwarding:
To configure Host
header forwarding with legacy forwarded values
-
In the CloudFront console, select your distribution.
-
Choose the Behaviors tab.
-
Select the behavior you want to modify.
-
In the Cache key and origin requests section, select Legacy cache settings.
-
In the Headers dropdown, select Whitelist.
-
Add the following headers to the whitelist:
-
Host
-
User-Agent
-
Accept-Encoding
-
X-Forwarded-For
-
-
Save your changes.
Note
The legacy forwarded values approach is not recommended for new distributions. Consider migrating to origin request policies for better performance and easier management.
Verify Host
header forwarding
After configuring Host
header forwarding, verify that it's working
correctly:
To verify Host
header forwarding
-
Wait for your CloudFront distribution changes to deploy (this can take several minutes).
-
Make a test request to your CloudFront distribution for a manifest.
-
Check that the manifest is returned successfully and contains the expected CDN URLs.
-
Monitor MediaTailor logs to ensure requests are being processed correctly.
If you encounter issues, see the CDN troubleshooting documentation for guidance.
Additional resources
For more information about CloudFront header forwarding, see the following resources:
-
How do I configure CloudFront to forward headers to the origin?
in the AWS Knowledge Center -
Controlling origin requests in the CloudFront Developer Guide
-
Using managed origin request policies in the CloudFront Developer Guide