Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate s3 custom error page when url expire

Tags:

amazon-s3

We have generated s3 pre-signed download url using java sdk. Now when it expires an xml error page comes like

<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
<X-Amz-Expires>43198</X-Amz-Expires>
<Expires>2016-07-11T20:32:43Z</Expires>
<ServerTime>2016-07-12T05:53:18Z</ServerTime>
<RequestId>76FF61E84B37E053</RequestId>
<HostId>
S3YVhGnr+7C9fFbjaKGhGyBHIaq/Y8j8jHmfC7P31zgydJr`enter code here`QAYqROb8U1+Eq5CyV7u+OLItkd+0=
</HostId>
</Error>

Instead of this we want a custom page to come. We are not hosting any website, simply wish to download some excel file from bucket.

like image 880
mou Avatar asked Oct 26 '25 09:10

mou


1 Answers

This is not possible with S3 pre signed urls at the moment.

  • Only seems to be supported for S3 static website hosting solution : http://docs.aws.amazon.com/AmazonS3/latest/dev/CustomErrorDocSupport.html

  • To see if it is supported yet check this search on the s3 docs

like image 88
basarat Avatar answered Oct 29 '25 00:10

basarat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!