2

enter image description here

I have a downloadable something.pkg file hosted in an Amazon S3 bucket (https://myassets.s3.amazonaws.com/something.pkg)

many people have this link but I don't want people anymore to be able to download it anymore but to be redirected to my_website.com/file_landing_page/

trying to edit the metadata of the file (as seen in the photo), setting the key x-amz-website-redirect-location to my new location does not do anything.

how can I redirect the object from the s3 console please?

smac2020
  • 9,637
  • 4
  • 24
  • 38
J. V.
  • 366
  • 3
  • 9
  • Does this answer your question? [S3 web page redirect: can't set x-amz-website-redirect-location property](https://stackoverflow.com/questions/41133075/s3-web-page-redirect-cant-set-x-amz-website-redirect-location-property) – Joe Sep 03 '21 at 11:09
  • I am trying to set it up with the console, not sure how to do that. metadata key x-amz-meta-website-redirect-location does not work. – J. V. Sep 03 '21 at 11:23
  • I set it up like in the example but it doesn't work – J. V. Sep 03 '21 at 12:00

1 Answers1

2

In order to achieve redirection from an S3 object, the bucket has to be configured for static website hosting. You can check here https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-to-page-redirect.html

After that setting x-amz-website-redirect-location property to the object metadata is going to work, but only from the s3 website endpoint (https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteEndpoints.html):

  1. s3-website dash (-) Regionhttp://bucket-name.s3-website-Region.amazonaws.com

  2. s3-website dot (.) Regionhttp://bucket-name.s3-website.Region.amazonaws.com

Unfortunately in your case even if you configure the bucket to be static your users are still using the https://myassets.s3.amazonaws.com/something.pkg which is not going to redirect.