botocore icon indicating copy to clipboard operation
botocore copied to clipboard

Support S3 HTTP redirects to non-Amazon URI's by using the location header

Open GeorgeJahad opened this issue 3 years ago • 8 comments

Is your feature request related to a problem? Please describe. I'm a developer contributing to Apache Ozone, an S3 compatible object store.

I would like to use HTTP redirects to balance the load amongst Ozone-based s3 servers, but botocore doesn't currently support redirects to non-amazon URI's.

Typically, http clients implement redirects using the 'location' header in the response as the destination. botocore uses the region instead of the location header . From that, it constructs an amazonaws.com based URI to redirect to. This means that botocore only ever redirects s3 requests to amazon URI's even if it made the original request to a non-Amazon server.

Describe the solution you'd like Allow botocore to support s3 redirection to non-Amazon URI's using the location header if available. This functionality would be controlled by a config variable or command line option, and would be off by default.

It could look something like this.

GeorgeJahad avatar Nov 29 '21 21:11 GeorgeJahad

Thanks @GeorgeJahad for opening this feature request here for discussion. I will link the issue where this was initially brought up: https://github.com/aws/aws-cli/issues/6559

tim-finnigan avatar Nov 30 '21 16:11 tim-finnigan

Hi @tim-finnigan: Just wondering if anyone has had time to consider this?

GeorgeJahad avatar Dec 08 '21 16:12 GeorgeJahad

Hi @GeorgeJahad I don’t have any updates. Generally new feature requests will remain open for a while in order to gauge community demand before the work would be considered or prioritized by the team.

tim-finnigan avatar Dec 14 '21 14:12 tim-finnigan

@tim-finnigan this is very important when we need to have rack-aware reads. S3 being a HTTP-based service, redirect seems like a standard operation to support.

kerneltime avatar Dec 16 '21 17:12 kerneltime

@tim-finnigan yep this feature will be very useful. Plus it's already supported I think in the Java SDK for S3. This will just make the python lib to behave like the java one. It will be great if this PR could be accepted!

michelsumbul avatar Dec 21 '21 16:12 michelsumbul

+1 @michelsumbul @GeorgeJahad @tim-finnigan. This will be a useful feature and it also keeps it compatible with Java SDK for S3.

prashantpogde avatar May 12 '22 16:05 prashantpogde

@GeorgeJahad @tim-finnigan We've submitted PR https://github.com/boto/botocore/pull/2830 which should help Apache Ozone out here (and NVIDIA AIstore for whom I wrote it) - it would be great to see this accepted.

simontraill avatar Dec 09 '22 17:12 simontraill

Hello @simontraill , @tim-finnigan , @GeorgeJahad .. Is this supported now ? I could see, still the Issue is in Open state. I was wondering, the changes could have went in as part of some other feature request/issue. Or, is there any workaround for now, so that we could use aws-cli/boto for non-AWS Server redirects ?

shivakumargowda12 avatar Nov 21 '23 07:11 shivakumargowda12