📜  在 110 上启用 cors - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:52.080000             🧑  作者: Mango

代码示例1
// 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