cdn for the built files(js, css)



  • If someone can point me to the right place where to configure so that I can serve the js and css files from a static URL.
    To elaborate
    Once I build my app and deploy on server
    website a.com and b.com can both access it. Here for e.g., Any js or CSS file will be served as ‘a.com/3edhf56.js’ or ‘b.com/3edhf56.js’ this duplicates the assets and CDN cost increases, if I can set these assets with ‘assests.c.com/3edhf56.js’ for both a.com and b.com it would be helpful. Any help on where I can make such a configuration?

    Thanks



  • @hexillion You can try something like this in your quasar.conf.js file. This is how I handle the same problem, and it works for me. I think this was the only think I had to do, so give it a shot and report back if it works, or something is still not working.

          extendWebpack (cfg) {
            if(cfg.mode === 'production') {
              cfg.output.publicPath = 'https://assets.c.com/'
            }
          }
    

    Edit: And of course, just serve this same webroot under assets.c.com, and maybe only allow serving js/css (and maybe images, etc depending on what you bundle,) or at least explicitly deny the index.html file from this assets subdomain.



  • @beets thanks for the input will try and report back


Log in to reply