AmazonS3: custom error pages

不问归期 提交于 2019-12-05 03:42:00

Yes, it's possible, see this announcement. In the Developer guide there is a paragraph about "Custom Error Document Support" where I read the following sentence.

You can optionally provide a custom error document with a user-friendly error message and with additional help. You provide this custom error document as part of adding website configuration to your bucket. Amazon S3 returns your custom error document for only the HTTP 4XX class of error codes.

How to set 4xx custom error page:

  • With CloudBerry, you can right click on a bucket, select Properties, click the tab Website and set the index document and the 4xx error document.

  • Use AWS Java SDK, here is an example code (not tested)

    AmazonS3 client = new AmazonS3Client(new BasicAWSCredentials(
        "accessKey", "secretKey");
    BucketWebsiteConfiguration conf = new BucketWebsiteConfiguration(
        "index.html", "404.html");
    client.setBucketWebsiteConfiguration("bucketname.example.com", conf);
    

UPDATE I also found this blog post: Host Your Static Website on Amazon S3.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!