<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>SEO on Nelson Figueroa</title><link>https://nelson.cloud/categories/seo/</link><description>Recent content in SEO on Nelson Figueroa</description><image><title>Nelson Figueroa</title><url>https://nelson.cloud/apple-touch-icon.png</url><link>https://nelson.cloud/categories/seo/</link></image><language>en</language><lastBuildDate>Wed, 01 Apr 2026 22:35:32 -0700</lastBuildDate><atom:link href="https://nelson.cloud/categories/seo/index.xml" rel="self" type="application/rss+xml"/><item><title>Fix "Efficient Cache Policy" Warning on PageSpeed Insights When Using Amazon CloudFront</title><link>https://nelson.cloud/fix-efficient-cache-policy-warning-on-pagespeed-insights-when-using-amazon-cloudfront/?ref=rss</link><pubDate>Thu, 02 Jan 2025 00:00:00 +0000</pubDate><guid>https://nelson.cloud/fix-efficient-cache-policy-warning-on-pagespeed-insights-when-using-amazon-cloudfront/?ref=rss</guid><description>Get rid of the efficient cache policy warning on PageSpeed Insights by adding a &lt;code&gt;Cache-Control&lt;/code&gt; header to CloudFront.</description><content:encoded><![CDATA[<p>I ran into this warning recently on 

<a href="https://pagespeed.web.dev/" target="_blank" rel="noopener">PageSpeed Insights</a>: <em>&ldquo;Serve static assets with an efficient cache policy&rdquo;</em>. The warning highlighted three assets that had no &ldquo;Cache TTL&rdquo; defined:</p>
<img src="/fix-efficient-cache-policy-on-gsc/before.webp" alt="Efficient cache policy warning on PageSpeed Insights" width="720" height="295" style="max-width: 100%; height: auto; aspect-ratio: 1904 / 782;" loading="lazy" decoding="async">
<p>To resolve this warning, I added a <code>Cache-Control</code> header with the value <code>max-age=31536000</code> to the HTTP responses of my domain (<code>31536000</code> is the number of seconds in a year).</p>
<p>I host 

<a href="https://nelson.cloud" target="_blank" rel="noopener">nelson.cloud</a> on 

<a href="https://aws.amazon.com/cloudfront/" target="_blank" rel="noopener">Amazon CloudFront</a>. I added this header to the CloudFront Distribution that the <code>nelson.cloud</code> domain points to. This can be done by adding a &ldquo;Response headers policy&rdquo; in the Behavior of the Distribution. I wrote a post demonstrating how to do this in detail: 

<a href="https://nelson.cloud/how-to-add-a-custom-response-header-to-an-amazon-cloudfront-distribution/">How to Add a Custom Response Header to an Amazon CloudFront Distribution</a>.</p>
<p>After the header was configured, I checked PageSpeed Insights again and the warning had gone away for the assets under my domain <code>nelson.cloud</code>:</p>
<img src="/fix-efficient-cache-policy-on-gsc/after.webp" alt="Efficient cache policy warning is gone for 2 assets." width="720" height="194" style="max-width: 100%; height: auto; aspect-ratio: 1912 / 516;" loading="lazy" decoding="async">
<p>(The remaining asset is not under my control so I can&rsquo;t fix that one.)</p>
<blockquote><p><strong>Note:</strong></p>You may be able to use a different value smaller than <code>31536000</code> for your header. I chose a year in seconds to be on the safe side for PageSpeed Insights.</blockquote>

<h2 id="references">References</h2>
<ul>
<li>

<a href="https://developer.chrome.com/docs/lighthouse/performance/uses-long-cache-ttl/" target="_blank" rel="noopener">https://developer.chrome.com/docs/lighthouse/performance/uses-long-cache-ttl/</a></li>
<li>

<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control" target="_blank" rel="noopener">https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control</a></li>
<li>

<a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html" target="_blank" rel="noopener">https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html</a></li>
</ul>
]]></content:encoded></item></channel></rss>