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

remove redirector for S3 API calls #1601

Merged
merged 1 commit into from Dec 20, 2021

Conversation

harshavardhana
Copy link
Member

S3 APIs behave in non-standard style
not following HTTP spec for redirections

Refer here

https://github.com/aws/aws-sdk-go/blob/main/service/s3/s3manager/bucket_region.go#L117

// Disable HTTP redirects to prevent an invalid 301 from eating the response
// because Go's HTTP client will fail, and drop the response if an 301 is
// received without a location header. S3 will return a 301 without the
// location header for HeadObject API calls.
req.DisableFollowRedirects = true

Fixes the issue minio/minio#13918

S3 APIs behave in non-standard style
not following HTTP spec for redirections

Refer here

https://github.com/aws/aws-sdk-go/blob/main/service/s3/s3manager/bucket_region.go#L117

```
// Disable HTTP redirects to prevent an invalid 301 from eating the response
// because Go's HTTP client will fail, and drop the response if an 301 is
// received without a location header. S3 will return a 301 without the
// location header for HeadObject API calls.
req.DisableFollowRedirects = true
```

Fixes the issue minio/minio#13918
@klauspost

This comment has been minimized.

@harshavardhana
Copy link
Member Author

@harshavardhana But the linked code is only for GetBucketRegion. It seems like this only applies for this call, not others.

It would seem that this change would be for all calls, which I could imagine would give a lot of regressions.

There is no redirection supported in S3 API. We added it for support some niche usecase.

I am just removing that nothing should regress anywhere AFAIK.

@harshavardhana
Copy link
Member Author

@harshavardhana But the linked code is only for GetBucketRegion. It seems like this only applies for this call, not others.

It would seem that this change would be for all calls, which I could imagine would give a lot of regressions.

GetBucketRegion is the first call you need to do before you do any bucket operations.

The redirection logic doesn't work with S3 protocol due to payload signature etc.

We had a hack on our end which worked to some extent for some calls that do not have a payload or body.

@harshavardhana harshavardhana requested review from poornas and removed request for vadmeste December 20, 2021 23:42
@harshavardhana
Copy link
Member Author

PTAL @donatello @vadmeste

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

Successfully merging this pull request may close these issues.

None yet

4 participants