Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

S3 redirect 302 object with s3cmd

I wish to create redirect object.

It is redirect to JSON file. HTML expires header will not work for me.

touch google
s3cmd --add-header='Location: http://www.google.com/' -P put google s3://bucket/google

It does not work as I do not set HTTP sttaus to 302

I prefer s3cmd as it is already installed on target server but python might ok as well if s3cmd can't do that.

like image 741
Eugene Avatar asked Apr 19 '14 11:04

Eugene


1 Answers

You should set x-amz-website-redirect-location header when putting object and access it via region specific website endpoint to archive this. See the document here: http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html

like image 119
petertc Avatar answered Oct 22 '22 10:10

petertc