Reputation: 33
Is it possible to bypass AWS Cloudfront for subdirectories of a domain?
E.g. 1) http://www.example.com/ is served from cloudfront cache 2) http://www.example.com/downloads/* is served from the origin host directly without causing traffic costs at cloudfront
My understanding is if I create a behavior for the path /downloads/* and disable caching traffic is still going through cloudfront.
The reason is I have a small website that I want to be visible fast. But if the user decides to make a download of a big file latency is not an issue, but traffic on cloudfront is much more expensive than on my normal webhost.
Upvotes: 1
Views: 6244
Reputation: 2423
As the browser asks a nameserver to which IP it should connect (and the nameserver is queried by servername only, www.example.com in this case), every request goes to CloudFront, regardless of subdirectory.
If you want to avoid CloudFront traffic charges you could send an HTTP redirect status that redirects to another domain (downloads.example.com), which is not behind CloudFront.
Upvotes: 1