Add CNAME to point subdomain to folder within Amazon S3 bucket

I want to be able to dynamically publish users sites in a single Amazon bucket.
Each of them in a different folder.

Then I want to provide them with a sub-domain for each of those folders.

Is this something that has to be done from Cloudflare or from Amazon S3 ?
And if it has to be done here, how ?

Off the top of my head, it would have to be a fancy Workers script. You’d have to already have those subdomains set up in Cloudflare DNS, and the fancy Worker script assigned to the route *.example.com/* (this kinda blows up if someone tries to go to the ‘www’ hostname for your site, though)

Then the script would have to read the hostname, and make it the folder name of your bucket.

A model script is below, but I don’t see how AWS could do this since the bucket is mapped to a hostname.

So you mean this is something I would need to do from here instead of from AWS?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.