amazon s3 - S3 upload on https with dots in bucket name -
i've been trying implement ajax upload amazon's s3 on site uses https, of course have upload secure version of s3, https://bucket.name.s3.amazonaws.com. however, when try upload, end getting error site has invalid security certificate. reading, expected because amazon's s3 certificate covers 1 level of subdomains (http://shlomoswidler.com/2009/08/amazon-s3-gotcha-using-virtual-host.html). therefore, changed url i'm uploading to https://s3.amazonaws.com/bucket.name, i've read, supposed equivalent https://bucket.name.s3.amazonaws.com. however, attempts upload there gave me 301 permanent redirect error. know fact code works, because when attempted instead upload bucket no dots in name, https://bucket.s3.amazonaws.com, went through fine, gets 301 when attempt https://s3.amazonaws.com/bucket.
<form id="form"> <input type="hidden" name="key" value="..." /> <input type="hidden" name="acl" value="public-read" /> <input type="hidden" name="x-amz-credential" value="..." /> <input type="hidden" name="x-amz-algorithm" value="..." /> <input type="hidden" name="x-amz-date" value="..." /> <input type="hidden" name="policy" value="..." /> <input type="hidden" name="x-amz-signature" value="..." /> <input type="hidden" name="success_action_redirect" value="..." /> <input id="upload" type="submit" value="upload" class="submit-upload clearfix button blue save"/> </form> <script type="text/javascript"> document.getelementbyid('upload').addeventlistener('click', function (e) { e.preventdefault(); var formdata = new formdata(document.getelementbyid('form')); var xhr = new xmlhttprequest(); xhr.open('post', 'https://s3.amazonaws.com/bucket.name/', true); xhr.send(formdata); }); </script>
so question is: there way implement ajax upload s3 bucket dots in name on https?
on http://docs.aws.amazon.com/amazons3/latest/dev/virtualhosting.html
amazon s3 supports virtual hosted-style , path-style access in regions. path-style syntax, however, requires use region-specific endpoint when attempting access bucket. example, if have bucket called mybucket resides in eu, want use path-style syntax, , object named puppy.jpg, correct uri http://s3-eu-west-1.amazonaws.com/mybucket/puppy.jpg. receive "permanentredirect" error, http response code 301, , message indicating correct uri resource if try access bucket outside east (n. virginia) region path-style syntax uses either of following:
an endpoint region different 1 bucket resides, example, http://s3-eu-west-1.amazonaws.com bucket created in west (northern california) region
Comments
Post a Comment