Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 22, 2025

Cloudflare was revalidating all JavaScript, CSS, and image files on every request because nginx was not sending cache-control headers.

Changes

Updated nginx configurations for production and staging:

Before:

map $sent_http_content_type $expires {
    "text/html"                 epoch;
    "text/html; charset=utf-8"  epoch;
    default                     off;  # No cache headers sent
}

After:

map $sent_http_content_type $expires {
    "text/html"                 epoch;
    "text/html; charset=utf-8"  epoch;
    default                     1y;
}

map $sent_http_content_type $cache_control {
    "text/html"                 "no-cache, no-store, must-revalidate";
    "text/html; charset=utf-8"  "no-cache, no-store, must-revalidate";
    default                     "public, max-age=31536000, immutable";
}

Static assets (JS/CSS/images) now cache for 1 year with immutable flag. HTML remains uncached. Safe because Nuxt generates content-hashed filenames (app.abc123.js).

Files Modified

  • provisioning/production/files/nginx/production.conf
  • provisioning/staging/files/nginx/staging.conf

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • iojs.org
    • Triggering command: /usr/bin/curl curl --fail --compressed -q -L -s REDACTED -o - (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Cache-control is preventing cloudflare from caching scripts</issue_title>
<issue_description>For some reason all javascript files are being served directly from origin as cloudflare has to revalidate them every request. This defeats the whole purpose of a CDN. This feels like it's still in "dev" mode where it's never caching anything.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Maelstromeous <1776058+Maelstromeous@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix cache-control settings for Cloudflare caching Fix cache-control headers to enable CDN caching of static assets Nov 22, 2025
Copilot AI requested a review from Maelstromeous November 22, 2025 18:56
@Maelstromeous Maelstromeous marked this pull request as ready for review November 22, 2025 19:01
@Maelstromeous Maelstromeous merged commit 1f15ca6 into dev Nov 22, 2025
5 checks passed
@Maelstromeous Maelstromeous deleted the copilot/fix-cache-control-headers branch November 22, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache-control is preventing cloudflare from caching scripts

2 participants