Skip to content

Conversation

guillaumebriday
Copy link

I added the Cache-Control header to assets and media files.

Most of applications use the cache-busting pattern so to increase performance we can cache assets basically forever and I added the immutable directive.

As explained in the Mozilla documentation:

When a user reloads the browser, the browser will send conditional requests for validating to the origin server. But it's not necessary to revalidate those kinds of static resources even when a user reloads the browser, because they're never modified. immutable tells a cache that the response is immutable while it's fresh and avoids those kinds of unnecessary conditional requests to the server.

For instance, GitHub or Linkedin are already using it in production.

See:

@jaydrogers
Copy link
Member

Today I learned!! Thanks for sharing!

I have a few open source things with Spin that I'm trying to get out the door, but I will circle back and review once I have a chance. I really like where this is going.

Copy link

@angristan angristan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love this as well 👍 expires is the old way to set cache headers: https://stackoverflow.com/questions/5799906/what-s-the-difference-between-expires-and-cache-control-headers

@jaydrogers
Copy link
Member

I am evaluating this for v3.6 and will keep you posted 👍

@jaydrogers jaydrogers changed the base branch from main to release/v3.6 March 11, 2025 17:09
@jaydrogers
Copy link
Member

This all looks great to me! I appreciate you both providing such factual resources for me to learn on this.

I was able to run some tests locally and my "Haha Business" guy had the exact caching experience that I wanted.

I will get this merged in 3.6 👍

Screenshot 2025-03-11 at 12 32 40@2x

@jaydrogers jaydrogers merged commit c73193f into serversideup:release/v3.6 Mar 11, 2025
@github-project-automation github-project-automation bot moved this from 🤔 Evaluating to Done in serversideup/php v4.0 Mar 11, 2025
@guillaumebriday guillaumebriday deleted the patch-1 branch March 16, 2025 20:07
@guillaumebriday
Copy link
Author

Awesome! Thanks for the merge 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants