javascript - BrowserSync + gulp: Cross domain Cors Issue -
i'm working on project workspace directly in distant server.
so far i'm loading browser-sync-client using own ip in src file:
<script type='text/javascript' id="__bs_script__">//<![cdata[ document.write("<script async src='myip:3000/browser-sync/browser-sync-client.1.9.2.js'><\/script>".replace(/host/g, location.hostname).replace(/port/g, location.port));//]]></script>
but run cross-origin request issue.
any idea how configure gulp ?
browsersync({files: [constants.css_folder+"/**/*.css"]});
thanks !
i not sure if understand trying do, can add middleware in browsersync , there can add header want.
it this:
browsersync({ server: { basedir: './build', middleware: function (req, res, next) { res.setheader('access-control-allow-origin', '*'); next(); } } });
Comments
Post a Comment