大网数据广告活动
网站运营与故障问答

Cannot add "Host" header in Cloudfront

· 52CE 我爱测

I am trying to add the "Host" header as a custom header when creating an Amazon Cloudfront Distribution. However, I always get the error "The parameter HeaderName : Host is not allowed". I tried to edit the "Cache policy" by goin…

问题原文

原帖链接 · alancc · CC BY-SA 4.0

I am trying to add the "Host" header as a custom header when creating an Amazon Cloudfront Distribution. However, I always get the error "The parameter HeaderName : Host is not allowed".

I tried to edit the "Cache policy" by going to "Cache key settings" -> "Headers - Include the following headers" and add "Host" to the list. But this still didn't work. What is the problem?

社区高分解答

原帖链接 · Muhammad Dyas Yaskur · CC BY-SA 4.0

Official docs says

You can’t configure CloudFront to add any of the following headers to requests that it sends to your origin:

  • Cache-Control

  • Connection

  • Content-Length

  • Cookie

  • Host

  • If-Match

  • If-Modified-Since

  • If-None-Match

  • If-Range

  • If-Unmodified-Since

  • Max-Forwards

  • Pragma

  • Proxy-Authorization

  • Proxy-Connection

  • Range

  • Request-Range

  • TE

  • Trailer

  • Transfer-Encoding

  • Upgrade

  • Via

  • Headers that begin with X-Amz-

  • Headers that begin with X-Edge-

  • X-Real-Ip

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2021-08-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。