0

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:

enter image description here

As you can see I have 2 types of Responses:

  1. Images: I want the images to be served from S3 bucket (I want images to be cached in CloudFront edge locations).

  2. 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?

enter image description here

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:

enter image description here

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)

enter image description here

So both disabling the cache and using my own custom policy works fine... is there any benefit in using either of these options?

Hooman Bahreini
  • 486
  • 6
  • 14

0 Answers0