Configure Host header forwarding - AWS Elemental MediaTailor

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
  1. In the CloudFront console, select your distribution.

  2. Choose the Behaviors tab.

  3. Select the behavior you want to modify or create a new behavior.

  4. For Origin request policy, you have two options:

    1. Option 1 (Recommended): Select AllViewer managed policy, which forwards all viewer headers including Host.

    2. Option 2: Create a custom origin request policy that specifically includes the Host header:

      1. Choose Create policy.

      2. In the Headers section, select Include the following headers.

      3. Add Host to the list of headers.

      4. Also include other required headers: User-Agent, Accept-Encoding, and X-Forwarded-For.

      5. Save the policy and apply it to your behavior.

  5. 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
  1. In the CloudFront console, select your distribution.

  2. Choose the Behaviors tab.

  3. Select the behavior you want to modify.

  4. In the Cache key and origin requests section, select Legacy cache settings.

  5. In the Headers dropdown, select Whitelist.

  6. Add the following headers to the whitelist:

    • Host

    • User-Agent

    • Accept-Encoding

    • X-Forwarded-For

  7. 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
  1. Wait for your CloudFront distribution changes to deploy (this can take several minutes).

  2. Make a test request to your CloudFront distribution for a manifest.

  3. Check that the manifest is returned successfully and contains the expected CDN URLs.

  4. 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: