Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 ambient origin strategy should handle different S3 URL formats #786

Open
donaldgray opened this issue Apr 5, 2024 · 0 comments
Open
Labels

Comments

@donaldgray
Copy link
Member

The current implementation of s3-ambient origin strategy will match the provided origin purely via regex. However, there are multiple different s3 path formats that are valid. e.g.

  • https://s3.{region-code}.amazonaws.com/{bucket}/{key} - path-style
  • https://s3.amazonaws.com/{bucket}/{key} - legacy path-style (us-east-1 only)
  • https://{bucket}.s3.{region-code}.amazonaws.com/{key} - virtual-hosted-style
  • https://{bucket}.s3-{region-code}.amazonaws.com/{key} - legacy virtual-hosted-style (some older regions only)
  • https://{bucket}.s3.amazonaws.com/{key} - legacy global (us-east-1 only)
  • s3://{bucket}/{key} - s3 URI

We might not want to support all of these but it would be good to be able to identify that different formats of S3 URIs are actually pointing at the same file. Sometimes it can be confusing to identify which format a particular s3-ambient origin strategy is using as it can affect whether the incoming request is treated as S3 ambient or not.

RegionalisedObjectInBucket class has parsing logic for different formats. There are also helper methods to generate https:// and s3:// URIs from an ObjectInBucket.

Also need to bear in mind that a https:// URI that points at an s3 bucket could be serving an open object over http.

Would we want to support s3:// URIs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant