Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Cache-Control header to assets and media files #487

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

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.

2 participants