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

CNAME to S3 returns the S3 URL

· 52CE 我爱测

I've setup a static website on S3 under a www.mydomain.com bucket. I also created a CNAME record for it in Namecheap looking like this: Type: CNAME Record Host: www Value: www.mydomain.com.s3-website-ap-southeast1.amazonaws.com I…

问题原文

原帖链接 · Conrad · CC BY-SA 3.0

I've setup a static website on S3 under a www.mydomain.com bucket. I also created a CNAME record for it in Namecheap looking like this:

  • Type: CNAME Record
  • Host: www
  • Value: www.mydomain.com.s3-website-ap-southeast1.amazonaws.com

It redirects correctly when I go to www.mydomain.com but the URL being displayed is of S3 and not my domain. If it helps, here's some output from dig:

;; ANSWER SECTION:
www.mydomain.com.    1177    IN      CNAME   www.mydomain.com.s3-website-ap-southeast-1.amazonaws.com.
www.mydomain.com.s3-website-ap-southeast-1.amazonaws.com. 60 IN CNAME s3-website-ap-southeast-1.amazonaws.com.
s3-website-ap-southeast-1.amazonaws.com. 5 IN A 54.231.242.137

When I checked the headers from curl, I got a 301.

已采纳解答

原帖链接 · Conrad · CC BY-SA 3.0

Figured it out - in have two buckets in S3 - mydomain.com and www.mydomain.com. mydomain.com is where the site is, and I set www.mydomain.com to redirect to mydomain.com.s3-website-ap-southeast1.amazonaws.com... I moved the files to www.mydomain.com and removed the redirect.

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

资料来源与适用范围

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

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

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