Is there a way to configure a single CloudFront distribution with S3 so that
hello.world.com
will serve files from my-bucket.s3.amazonaws.com/hello
, and foo.world.com
will serve files from my-bucket.s3.amazonaws.com/foo
?
I've added a new distribution with wildcard CNAME of *.world.com and I can add origins as described (by specifying root folder), but I don't know how to route requests based on subdomain. In the behaviour settings, there is path pattern
but I don't think it applies to a domain, rather than the path to a file.
Basically I wanna do path rewrite to replace the first directory with the subdomain on a single cloudfront distribution with a single s3 bucket.
foo.example.com/buzz >> example-bucket/foo/buzz
andbar.example.com/buzz >> example-bucket/bar/buzz
. – Pleasant