I am working on an e-commerce website, where users can buy/sell products (the website is dynamic)
I have created the following CloudFront distribution with the following Behaviors:
As you can see I have 2 types of Responses:
Images: I want the images to be served from S3 bucket (I want images to be cached in CloudFront edge locations).
Dynamic Web Pages: I want to forward them to my Web server (Load Balancer)
Now this question is about the dynamic pages, I am not sure about the Cache Policy that I should choose?
Option 1: Since these pages are dynamic, I can choose Managed-CachingDisabled policy
Option-2: I can define my own custom caching policy… I have tested the the website with the following custom policy and it works fine:
With the above custom policy in place, I have inspected the web requests…
I noticed that the dynamic web pages won’t be cached (they all have Miss from CloudFront).., this is because IIS adds
cache-control: private to all responses (private means the response can only be cached in web browser)
So both disabling the cache and using my own custom policy works fine… is there any benefit in using either of these options?