Managed-CachingOptimized not caching file

0

I have set a behavior for "/robots.txt". It comes before than the default behavior (precedence). Cache policy name is Managed-CachingOptimized. Origin request policy name is not set (empty). Response headers policy name is not set (empty). This is a pretty standard setting for caching. Cloudfront origin is ELB for EC2. But Cloudfront is not caching the static text file. There is no x-cache information on response headers (hit from Cloudfront or miss from Cloudfront). Here are the response headers:

accept-ranges: bytes
content-encoding: gzip
content-length: 430
content-type: text/plain
date: Wed, 24 Aug 2022 03:19:41 GMT
etag: "38e-5e3c786e719d0-gzip"
last-modified: Thu, 14 Jul 2022 17:49:44 GMT
server: Apache/2.4.54 (Ubuntu)
set-cookie: AWSALB=ZJcMr4JytpQ5+YBldD+ytbG2n855hylXciCYrcZ2hfQeJDaiz3KgBQn7ALjo+BpsZd5SHKN4c9u/zFQ9oXolGHEqVQZTBQ6K9FUWaICEh6JFQVefjwE1oiiZ0qnI; Expires=Wed, 31 Aug 2022 03:19:41 GMT; Path=/
set-cookie: AWSALBCORS=ZJcMr4JytpQ5+YBldD+ytbG2n855hylXciCYrcZ2hfQeJDaiz3KgBQn7ALjo+BpsZd5SHKN4c9u/zFQ9oXolGHEqVQZTBQ6K9FUWaICEh6JFQVefjwE1oiiZ0qnI; Expires=Wed, 31 Aug 2022 03:19:41 GMT; Path=/; SameSite=None; Secure
vary: Accept-Encoding

Here are the request headers:

:authority: fisiculturismo.com.br
:method: GET
:path: /robots.txt
:scheme: https
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
cookie: __gads=ID=62782a8f5a755c77-222f0dc46e7c004b:T=1656794055:RT=1656794055:S=ALNI_MZqlDHMRjqwWm8dbUOgnXV24kmbUg; ips4_device_key=75b924dcdd29d88a78f9c1f395ca5f66; ips4_forum_view=table; ips4_notificationMenuShown=1659848309910; _ga=GA1.3.334719718.1660926268; _gid=GA1.3.682253330.1661275622; ips4_hasJS=true; __gpi=UID=0000073c0158a521:T=1656794055:RT=1661275623:S=ALNI_MYpOpUI6AcXcKskOFNUnNYr4WbIiw; ips4_IPSSessionFront=bd8bigqv1ops6dg8t0908dloh7; ips4_ipsTimezone=America/Sao_Paulo; AWSALB=4NY1ew2QGqkW4EzEz5z++28mVVUN40npwXy8/zsx21tXGepo9aBFaFUdBJVv+s9rC2342LRKOT74PqryKTKDMpUfOGorDsLd5s8/R55cmVQDOF0VSm+oOqD8EfR2; AWSALBCORS=4NY1ew2QGqkW4EzEz5z++28mVVUN40npwXy8/zsx21tXGepo9aBFaFUdBJVv+s9rC2342LRKOT74PqryKTKDMpUfOGorDsLd5s8/R55cmVQDOF0VSm+oOqD8EfR2
pragma: no-cache
sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "macOS"
sec-fetch-dest: document
sec-fetch-mode: navigate
sec-fetch-site: none
sec-fetch-user: ?1
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36

What could be causing the issue?

Igor
asked 2 years ago636 views
1 Answer
0

It looks like you haven't configured DNS to use CloudFront. It looks like your domain name is resolving to a load balancer IP address.

As you're using the apex domain name, you'll need to configure an Alias record in Route53 to point to your distribution's DNS name: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html

AWS
EXPERT
Paul_L
answered 2 years ago
  • Yes! Perfect! That was the issue. Now it's working fine! Thanks a lot. Just to let you know, on Route53, when I tried to set Cloudfront as A and AAA record, the domain that was shown as from ELB. I had to turn off and then turn on alias to Route53 show the cloudfront domain.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions