Search code examples
firebasevue.jsvuejs2cdngoogle-cloud-cdn

How to configure firebase cdn / caching in Vue.js app?


I have developed my project using vue.js webpack template. I want to configure firebse cdn/caching. But have no idea what to do..

I have gone through the document https://firebase.google.com/docs/hosting/manage-cache

And found that

res.set('Cache-Control', 'public, max-age=300, s-maxage=600');

to be added. But wheredo i add in my vuejs project before deploying. Please if anyone could help me.


Solution

  • The method res.set sets the response’s HTTP header field to value. This link you have provided, refers to setting the headers when using Google Cloud Functions. You can take a look at this Github link containing an example about Google Cloud Functions which include how to set these headers in NodeJS. To get more general information about res.set() and how you can set these headers in your own application, you can also take a look at the official documentation.