【发布时间】:2021-06-25 02:02:15
【问题描述】:
我拥有 covaxx.dev 域,但它是在 NameCheap 注册的,而不是在 AWS Route53 注册的。
我遵循基本的guide to create a "static website" in S3,这工作得很好,index.html 按预期提供,存储桶名为covaxx.dev(应该如此)。
在 NameCheap 上,我已配置 DNS 规则以启用 URL 重定向,如 here 所述,使用 @ 和 www Host 字段,类型为 URL Redirect Record 和 Value存储桶的 URL:http://covaxx.dev.s3-website-us-west-2.amazonaws.com/。
当我尝试使用curl(或httpie)访问该网站时,这是有回报的:
curl -L www.covaxx.dev
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Find Vaccine</title>
</head>
<body>
<h1>Find Vaccine</h1>
<p>This script checks CVS.com for appointment locations near you with available vaccine doses:
it uses the Google Map API to find those which are within a given distance
from the user's chosen location.</p>
<h6>Copyright © 2021 AlertAvert.com All rights reserved.</h6>
</body>
</html>
从完整的跟踪 [0] 我可以看到重定向指向正确的位置(www.covaxx.dev 和 covaxx.dev) - 到目前为止,一切都很好。
但是,当我尝试在浏览器(Firefox、Linux 和 MacOS;以及 Safari、MacOS、iOS)中加载页面时,它们一直在旋转,然后出现“服务超时”错误而超时。
老实说,这对我来说没有任何意义,我怀疑这可能与我的超偏执浏览器设置有关,但我不确定为什么会发生这种情况。 (我什至禁用了我的 VPN,以防它产生影响,但没有改变)。
非常感谢您解开谜团的任何帮助,在此先感谢!
[0] 完整跟踪:
$ curl -v -L www.covaxx.dev
* Trying 192.64.119.50:80...
* TCP_NODELAY set
* Connected to www.covaxx.dev (192.64.119.50) port 80 (#0)
> GET / HTTP/1.1
> Host: www.covaxx.dev
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Server: nginx
< Date: Mon, 29 Mar 2021 00:12:07 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 76
< Connection: keep-alive
< Location: http://covaxx.dev.s3-website-us-west-2.amazonaws.com/
< X-Served-By: Namecheap URL Forward
<
* Ignoring the response-body
* Connection #0 to host www.covaxx.dev left intact
* Issue another request to this URL: 'http://covaxx.dev.s3-website-us-west-2.amazonaws.com/'
* Trying 52.218.234.242:80...
* TCP_NODELAY set
* Connected to covaxx.dev.s3-website-us-west-2.amazonaws.com (52.218.234.242) port 80 (#1)
> GET / HTTP/1.1
> Host: covaxx.dev.s3-website-us-west-2.amazonaws.com
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< x-amz-id-2: s6Hcwjf1E0Prv4QLJTGh9EaTZn5K1YTJy3FmQEtk598OIMyDv/wDeWFR/gzhgn1wgYAN5a/Y2bk=
< x-amz-request-id: 57BM0MN4P842GRFP
< Date: Mon, 29 Mar 2021 00:12:09 GMT
< Last-Modified: Mon, 29 Mar 2021 00:12:03 GMT
< ETag: "8853123d304bc0f26bbe8af3e7a1f71a"
< Content-Type: text/html
< Content-Length: 429
< Server: AmazonS3
<
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Find Vaccine</title>
</head>
<body>
<h1>Find Vaccine</h1>
<p>This script checks CVS.com for appointment locations near you with available vaccine doses:
it uses the Google Map API to find those which are within a given distance
from the user's chosen location.</p>
<h6>Copyright © 2021 AlertAvert.com All rights reserved.</h6>
</body>
</html>
* Connection #1 to host covaxx.dev.s3-website-us-west-2.amazonaws.com left intact
【问题讨论】:
-
即使你的域名没有注册到Route53,你也可以把它托管在Route53上,只要把Namecheap DNS服务器改成AWS DNS Servers,然后为那个域创建一个区域,最好用CloudFront使用您的 S3 托管网站,然后将您的域名重定向到 CloudFront 分配
-
您多久前设置了重定向?在您的浏览器中,启用调试 (F12)。重新加载页面并观察网络跟踪。您看到了哪些活动和问题?刷新本地 DNS 缓存
ipconfig /flushdns(windows) 或类似的 Linux。使用 mxtoolbox.com 等 Internet 工具验证您的 DNS 设置。
标签: curl amazon-s3 redirect dns