创建Amazon S3的我自己的错误页面 [英] Create my own error page for Amazon S3

查看:187
本文介绍了创建Amazon S3的我自己的错误页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以创建我的S3存储桶我自己的错误页面。我有CloudFront的启用,我用我自己的CNAME到S3分配给子域为我的网站。这可以帮助我创建引用我的域名整齐的联系。

I was wondering if it's possible to create my own error pages for my S3 buckets. I've got CloudFront enabled and I am using my own CNAME to assign the S3 to a subdomain for my website. This helps me create tidy links that reference my domain name.

当有人试图访问已被也许删除的文件或链接是不太正确的,他们得到的XML S3错误页面是丑陋的,而不是非常有帮助的用户。

When someone tries to access a file that has perhaps been deleted or the link isn't quite correct, they get the XML S3 error page which is ugly and not very helpful to the user.

有没有办法来覆盖这些错误页面这样我就可以显示一个有用的HTML页面,而不是?

Is there a way to override these error pages so I can display a helpful HTML page instead?

推荐答案

如果您配置水桶为网站,您可以创建自定义错误页。

If you configure your bucket as a 'website', you can create custom error pages.

有关详细信息请参阅亚马逊宣布此功能和 AWS开发人员指南

For more details see the Amazon announcement of this feature and the AWS developer guide.

然而,有一些注意事项这种方法,一个主要的一个是,你的对象必须是公开的。

There are however some caveats with this approach, a major one being that your objects need to be publicly available.

这也适用于的Cloudfront,但同样的公共访问限制适用。请参见 https://forums.aws.amazon.com/ann.jspa?annID= 921

It also works with Cloudfront, but the same public access limitations apply. See https://forums.aws.amazon.com/ann.jspa?annID=921.

如果你愿意,你可以尝试这些了   马上通过配置您的亚马逊   S3斗作为一个网站,使该   新的Amazon S3网站端点   定制产地为您的CloudFront的   分配。一些注意事项,当你做   本。首先,你必须设置自定义   原产地协议方针,以仅HTTP。   其次,你需要使用一个工具,   支持CloudFront的定制原产地   特点 - AWS管理控制台   并不在这一点上提供此   特征。最后,请注意,当你   使用Amazon S3的静态网站   功能,都在你的S3内容   桶必须是可公开访问的,所以   你不能使用CloudFront的私人   内容特征与桶。如果   你想用私人内容   与S3,您需要使用S3 REST   端点(例如,s3.amazonaws.com)。

If you want, you can try these out right away by configuring your Amazon S3 bucket as a website and making the new Amazon S3 website endpoint a custom origin for your CloudFront distribution. A few notes when you do this. First, you must set your custom origin protocol policy to "http-only." Second, you’ll need to use a tool that supports CloudFront’s custom origin feature – the AWS Management Console does not at this point offer this feature. Finally, note that when you use Amazon S3’s static website feature, all the content in your S3 bucket must be publicly accessible, so you cannot use CloudFront’s private content feature with that bucket. If you would like to use private content with S3, you need to use the S3 REST endpoint (e.g., s3.amazonaws.com).

这篇关于创建Amazon S3的我自己的错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆