Source: paulund.co.uk

Add Cache Control To Nuxt3
HTTP caching allows you to store a response to a request allowing your browser to reuse stored responses for subsequent requests. This gives you advantage of not having to refetch content from the origin server allowing your visitors to have faster response times. You can quickly do this in your website applications by returning the HTTP header Cache-Control in the response. With Nuxt3 it will automatically load all files in the server folder, you can create a middleware folder which will mean you can add headers in the response coming from the nuxt server.

export default defineEventHandler((event) => { let res = event.res const year = 31536000 const hour = 60 * 60 const url = event.req.url const maxage = url.match(/(.+)\.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners