andrewrk / node-s3-client

high level amazon s3 client for node.js
MIT License
1k stars 305 forks source link

Follow Redirects #133

Closed DeviaVir closed 8 years ago

DeviaVir commented 8 years ago

Due to something completely not this library's fault, Amazon sometimes responds with a 307 redirect: http://docs.aws.amazon.com/AmazonS3/latest/dev/Redirects.html

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>TemporaryRedirect</Code><Message>Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests.</Message><Bucket>BUCKETNAME</Bucket><Endpoint>BUCKETNAME.s3-us-west-2.amazonaws.com</Endpoint><RequestId>688317AA50206CC1</RequestId><HostId>xjLXl9inxjNdrE82w1hhMUyUC39mhI/TCnYhzVQZyx7AKP56W1CWdfdaRZRTGWOJKEIcA2zMRN8=</HostId></Error>

It would be nice if this library could follow that redirect and perform the action there.

DeviaVir commented 8 years ago

Nevermind, can be resolved by setting in:

s3 = new AWS.S3({endpoint: THE_REDIRECT_ENDPOINT})