How S3 and CloudFront handle special chars in URLs

Special chars can break S3 URLs but CloudFront can help

Posted on February 10, 2017

Working with AWS S3 and CloudFront I found that they interpret URLs a bit differently.

To test this I've setup an S3 bucket with the Static Website Hosting configuration set to Enable website hosting. I've uploaded two files in the bucket, one named test+file.html, the other named test_file.html:

Notice the URL of the first file: the + sign has been replaced with %2B.

If we try to open S3 will complain, returning an Access Denied message.

But, if we activate CloudFront things are different. Both the following URLs work: