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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners