Use object redirects for AWS S3 file alt locations.

Description

S3 website redirection was added in GUISE-88. It used S3 routing rules, a special bucket-level configuration that allowed redirects to be specified for certain paths.

This seems to work well, but there's one is one huge roadblock: the number of redirects configured using routing rules is apparently limited to 50. If you go over that, the AWS SDK gives this error:

software.amazon.awssdk.services.s3.model.S3Exception: … routing rules provided, the number of routing rules in a website configuration is limited to 50. (Service: S3, Status Code: 400, Request ID: …)

Others have ran into this problem. However as someone pointed out on Stack Overflow, there was another redirect feature announced in 2012: object-level redirects.

With this approach one must store a zero-byte (or any content, apparently) object with a special x-amz-website-redirect-location metadata value that either indicates the path to another S3 object or a URL. We'll need to update the Guise Mummy S3 website deployment to use this object-based redirect, at least for files.

S3 websites now have a redirectMeans configuration setting, with these options:

  • optimal: (default) Functions like object except that if the total number of redirects is below redirectCountOptimalThreshold (which currently defaults to 30 but can be configured), functions like routing-rule.

  • object: All redirects use objects, except for redirects from collections, which must use routing rules.

  • routing-rule: All redirects use routing rules.

Environment

None

Assignee

Garret Wilson

Reporter

Garret Wilson

Labels

Components

Fix versions

Affects versions

Priority

Blocker
Configure