I am planning to share URLs (time limited) for private objects. Is there a way to set custom error pages for 404/403 http responses ?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With