cloudfront . browser caching

0

i want the browser to keep caching for period of time a cloudfront file i serve with out considering the last modified header and etag . and only after this period of time is over - only then i want to revialidate cloudfront again with the etag or last modifed . is it possible ? and how can i do it?

Ronen
질문됨 4달 전191회 조회
2개 답변
0

yes, you can configure Amazon CloudFront to cache content for a specified period of time without considering the Last-Modified header or ETag. This is achieved by setting the "Minimum TTL" (Time-To-Live) value for your CloudFront distribution.

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html

Here are the steps to configure this:

  1. Navigate to CloudFront Console:

  2. Select Your Distribution:

    • Select the CloudFront distribution for which you want to configure caching behavior.
  3. Edit the Cache Behavior:

    • In the "Distribution Settings" tab, navigate to the "Behaviors" section.
  4. Edit the Default Cache Behavior:

    • Select the default cache behavior (or the one relevant to your content) and click on "Edit."
  5. Set Minimum TTL:

    • In the "Object Caching" section, you will find "Minimum TTL." Set the desired value for the minimum time that CloudFront should cache the content without revalidating.
  6. Save Changes:

    • Click on "Yes, Edit" to save the changes to your cache behavior.

Kindly refer also to aws documentations for any doubts :-https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html

profile picture
전문가
답변함 4달 전
profile picture
전문가
검토됨 2달 전
  • im talking about the browser validation to cloudfront. u are talking about cloudfront re-validation against its origin ..... i did not mean that ? maybe something like header Cache-Control: max-age=14400 ?

0

Browsers always respect the value of cache headers to manage the lifecycle of local cache objects. CloudFront as a server can not control the client browser directly.

You can consider overwrite these cache header when responding these http header. You can leverage CloudFront response header policy to achieve this feature easily.

For example:

  • Remove Header: Last-Modified
  • Add Header: Cache-Control: max-age=1440

In this way browser respects the headers we crafted, after 1440 seconds, do the re-validation.

profile picture
답변함 4달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠