Optionally allow HTTP redirects #2830
Open
+289
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds (optional, client configured) support for the HTTP "location" header when processing HTTP redirects for S3 responses.
I'm a developer at NVIDIA; I wrote this on behalf of the AIStore project. We'd really like to use botocore (and boto3) for client access; AIStore (and some other systems - like Apache Ozone, referenced by this issue) rely on standard HTTP redirects - using the "location" header - for load balancing.
botocore constructs redirection URLs using the region instead, and won't allow redirections outside of known Amazon URIs.
I've gated the change here behind a config setting; that said, other AWS SDKs (aws-sdk-go, for instance) do appear to support redirects as normal, so hopefully this behaviour is in line with other clients.
This change -
allow_http_redirects
config option (default:False
).True
, performs HTTP redirection based on theLocation
headerI've added unit and functional tests and tried to keep the style consistent with your existing work. If there's any demand for caching using the
Cache-Control
orExpires
headers, I could certainly do it in the follow-up.Thanks.