S3 content redirects for multiple files

0

I am aware of how to redirect s3 bucket items using the metadata, but this works only for files that exist. Our developers archived and deleted over 500 files as a routine process and asked to have them redirected.

I have been looking for various solutions on how to resolve the dilemma of applying a redirect to the now missing content to another URL. I have read how to use advanced conditional redirects but it indicates that there's a limit of 50 items maximum that can be applied to the s3 bucket properties on the static web hosting. I'm trying to understand if that's 50 specific rules or 50 items objects that can have multiple redirects using a conditional. Would one behavior with 550+ removed items redirecting elsewhere (new url) count as one object, I've read elsewhere this doesn't work well. and is there any notable performance or impact in approaching it in this method?

I know its possible to create redirects in cloudfront by adding a behavior and developing a script to negotiate all the redirects similar to the above-mentioned approach.

已提问 8 个月前230 查看次数
1 回答
0

If you're already using CloudFront, you can use Lambda@Edge, which lets you run Lambda functions to customize content AWS delivers through CloudFront. You can store the origin and destination URL in a simple map and use simple match and replace functions to process redirects at the edge locations.

Remember that the Lambda@Edge needs to be deployed in us-east-1 and will record logs in the region from which the user accessed it.

Here are some links that are a good reference for what you're trying to build:

If the answer is helpful, please click "Accept Answer" and upvote it.

profile picture
专家
已回答 8 个月前
profile picture
专家
已审核 2 个月前
  • Perhaps thats something the developers should have presented to you as the solution as they should be aware of the setup

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容