Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
 
PREVIOUS NEXT
Tagged: #enable #cors #eleventy
ADD COMMENT
Topic
Name
1+4 =