Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

feat(nitro): Add Cache-Control and Etag headers to html response for cache server #2663

Closed
wants to merge 2 commits into from

Conversation

newbeea
Copy link

@newbeea newbeea commented Jan 11, 2022

πŸ”— Linked issue

[Add Cache-Control and Etag headers for cache server]#2662

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Describe your changes in detail
I add etag header and cache-control header to html response in renderMiddleware

Why is this change required? What problem does it solve?
In ssr mode, the html response doesn't has etag header, so the cdn or browser cannot get 304 when the html is same.
This feature will reduce transporting of html file

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify
Copy link

netlify bot commented Jan 11, 2022

βœ”οΈ Deploy Preview for nuxt3-docs canceled.

πŸ”¨ Explore the source changes: 4a132d8

πŸ” Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/61dd0372bc09c50008196377

@pi0
Copy link
Member

pi0 commented Mar 16, 2022

Thanks so much for this PR @newbeea πŸ’š and sorry it took long to respond.

Since we are moving to nitropack (#3161) and implementing route caching rules, it would be easier to implement this feature and with wider usability for static and API routes if we support etag outside of ssr renderer but directly for all server routes.

Although the project is still private, I've made an issue in order to keep track, and rest assured neither feature or your credits for idea won't be discarded.

I'm closing this PR for maintenance. Thanks for your patience and understanding.

Update: Generic cache util added to h3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants