1

I need to host some javascript files on Amazon s3 and would like to serve it through the amazon s3 url not through my domain.com using https

https://my.website.s3.amazonaws.com/js/custom.js

Is this offered for free or do I need to buy a SSL certificate?

KJW
  • 15,035
  • 47
  • 137
  • 243

1 Answers1

2

It's free. Basically Amazon provides the certificate for https://*.s3.amazonaws.com . If you are using your own DNS entry https:// then you need your own certificate.

Keep in mind that you might have to make cross domain javascript requests unless all of your site goes to: https://my.website.s3.amazonaws.com .

To do cross domain Javascript you need to use JSONP. You can read more about it here: Make cross-domain ajax JSONP request with jQuery

Or you can look at something like easyXDM

[Edit]

If for some reason your bucket has a dot or more in its name, for example: mybycket.is.great you can use the old style URL

https://s3.amazonaws.com/admobius.qa/mybucket.is.great/<bucket object>
Community
  • 1
  • 1
Rico
  • 58,485
  • 12
  • 111
  • 141
  • But... this is only usable on bucket names without dots... the wildcard cert is only good for one "level" of hostname... https:// for foo.s3.amazonaws.com works, but for foo.bar.s3.amazonaws.com doesn't... because the cert is not valid at additional hostname levels out. The bucket works, but the cert won't. – Michael - sqlbot Jan 30 '14 at 13:39
  • @Michael-sqlbot that's right, check my [Edit] for a workaround – Rico Jan 30 '14 at 15:45
  • this is for a bookmarklet I'm creating I need to load some JS from an https protocol – KJW Jan 30 '14 at 22:32