Cloud

Amazon S3 – boto – SSL error when serving image in HTTPS

Want to serve your secured/signed images or files in HTTPS where your files are served by Amazon S3? Getting SSL errors instead? I was about to ask same question in StackOverflow but suddenly I remembered oDesk is serving attachments via Amazon S3. I tried revisiting the old message attachments and noticed that they are all served via HTTPS, then I finally found the answer.

I’m not sure if this is the only case but in my case, the reason was the bucket name. If you are serving files by using signed URLs (ex: expiring urls), in my case, using the boto library, you will end up serving via this domain name format:

https://bucketname.s3.amazonaws.com

In my case, I have a "." character in my bucket name, making the domain look like this:

https://bucket.name.s3.amazonaws.com

The result is that bucket is a sub-domain of name which is a sub-domain of s2.amazonaws.con. To avoid the issue, simply avoid having the “.” character in your bucket name. Serving in HTTP is not an option seriously.

That’s it!

Leave a reply

Your email address will not be published. Required fields are marked *