Answers for "enable cors on eleventy"

0

enable cors on eleventy

// Enable CORS on 11ty > headers: {"Access-Control-Allow-Origin": "*"}
// Edit: eleventy.js:

module.exports = function(eleventyConfig) {
  eleventyConfig.setBrowserSyncConfig({
    middleware: function (req, res, next) {
        res.setHeader('Access-Control-Allow-Origin', '*');
        next();
      }
    });
};  

// References: https://medium.com/@matthewcrist/how-to-enable-cors-in-browsersync-6389e911764b
Posted by: Guest on May-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language