WIP: feat: x-amz-website-redirect-location
support #872
No reviewers
Labels
No labels
action
check-aws
action
discussion-needed
action
for-external-contributors
action
for-newcomers
action
more-info-needed
action
need-funding
action
triage-required
kind
correctness
kind
ideas
kind
improvement
kind
performance
kind
testing
kind
usability
kind
wrong-behavior
prio
critical
prio
low
scope
admin-api
scope
background-healing
scope
build
scope
documentation
scope
k8s
scope
layout
scope
metadata
scope
ops
scope
rpc
scope
s3-api
scope
security
scope
telemetry
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Deuxfleurs/garage#872
Loading…
Reference in a new issue
No description provided.
Delete branch "raitobezarius/garage:redirect-meta"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Each commit contains a piece of an implementation.
Fixes #869.
Open questions
/
,http://
orhttps://
GET
This is an implementation of the GET handler for the
x-amz-website-redirect-location
.This implements the semantics described in
https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-to-page-redirect.html
for the S3 API and the web API.
PUT
Just propagate the header.
PUT Copy
In case the metadata directive is REPLACE, we reuse the PUT propagated header.
In case the metadata directive is COPY, we probably need to check if the header is set and actually replace the header.
TODO:
Multipart
TODO:
Signed-off-by: Raito Bezarius masterancpp@gmail.com
bd44f702f2
to5275ae60b0
I have a feeling that this does not implement the expected semantics of
x-amz-website-redirect-location
. As I understand by reading the AWS docs, when the header is present:Fetching the object through the S3 API is not affected, the object is always returned as it exists. Its
x-amz-website-redirect-location
header is simply added to the HTTP headers of the responseAccessing the object as a web page through the web endpoint would yield an HTTP 301 with the
Location
header set to the value ofx-amz-website-redirect-location
I think that there is no case in which S3 internally interprets the redirection, and returns the targeted object instead of the original one. In particular, this means that there is no case where multiple layers of redirection are flattened internally by S3 (and we can get rid of async_recursion).
This is not certain but it's only my interpretation of the AWS documentation, which is very badly written. What we need to do here is to test against AWS S3 to see how it behaves, and then emulate that behavior.
@ -329,6 +332,30 @@ pub async fn handle_get_without_ctx(
let checksum_mode = checksum_mode(&req);
if let Some(redirect_hdr) = headers
We want this code path to trigger only for the web endpoint,
x-amz-website-redirect-location
should be ignored (i.e. simply returned as a normal object header) on the S3 endpoint.@ -332,0 +335,4 @@
if let Some(redirect_hdr) = headers
.headers
.iter()
.find(|(k, _)| k == "x-amz-website-redirect-location")
Could we define a constant as follows and use that instead?
@ -623,1 +623,3 @@
if name.as_str().starts_with("x-amz-meta-") {
if name.as_str().starts_with("x-amz-meta-")
|| name.as_str() == "x-amz-website-redirect-location"
{
The value of the header should be validated here to ensure it is syntactically correct, according to S3 rules
I think we should validate this as well.
I would expect that Amazon does not validate this, so I don't think we should validate it. We can test this on AWS if we want to be sure.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.