New, Better Asset URLs

The files you upload to CodePen with our PRO Asset Hosting feature have a public URL you can access them at. You might recognize a URL like this, that we used to give you:

https://s3-us-west-amazonaws.com/s.codepen.io/1/your-file.jpg

Or you might recognize that URL as being a direct URL to an Amazon S3 bucket. While that works, it’s not ideal for a couple of reasons:

  1. S3 isn’t a CDN. It’s the right place for asset storage, but not direct asset delivery. For one thing, notice the “us-west” in the URL. That’s OK for me literally being in the west of the U.S., but worse and worse of a choice the farther you are away. Rachel in Queensland, Australia didn’t exactly have fast assets.
  2. CORS issues. S3 can have a “bucket policy” that sets CORS headers, and we absolutely did that and it worked for the most part, but there was a really tricky little issue that could cache the asset with missing CORS headers and cause people grief.

So, we’re now serving up assets from a new URL, like this:

https://assets.codepen.io/1/your-file.jpg

Here’s what that transition is like:

Now…

  • The files are served from a global CDN, meaning everyone will get them much faster.
  • We can ensure the files are served with the right CORS headers no matter what.
  • This unlocks some additional cool features we’ll be making available soon, so stay tuned.

Do I have to do anything?

No. If you want to take advantage of this, you can update your “old” URLs to this new format, but you don’t have to, the old URLs will work fine forever.

We might ultimately update those URLs for you, just because it’s purely better.

The post New, Better Asset URLs appeared first on CodePen Blog.