enable cors on eleventy

Solutions on MaxInterview for enable cors on eleventy by the best coders in the world

showing results for - "enable cors on eleventy"
Emely
06 Aug 2017
1// Enable CORS on 11ty > headers: {"Access-Control-Allow-Origin": "*"}
2// Edit: eleventy.js:
3
4module.exports = function(eleventyConfig) {
5  eleventyConfig.setBrowserSyncConfig({
6    middleware: function (req, res, next) {
7        res.setHeader('Access-Control-Allow-Origin', '*');
8        next();
9      }
10    });
11};  
12
13// References: https://medium.com/@matthewcrist/how-to-enable-cors-in-browsersync-6389e911764b