gulp - browser-sync is blocked by chrome csp -


i have gulp task runs browsersync.

var options = {         proxy :          'localhost:9000/html' ,         port :           3000 ,         files :          [             config.root + config.srcpaths.htmlbundle ,             config.htmlroot + 'main.css' ,             '!' + config.htmlroot + '**/*.scss'         ] ,         injectchanges :  false ,         logfilechanges : true ,         logprefix :      'brosersync ->' ,         notify :         true ,         reloaddelay :    1000     }; browsersync( options ); 

browsersync detects changes , tries inject them chrome blocks error:

refused connect 'ws://localhost:3000/browser-sync/socket.io/?eio=3&transport=websocket&sid=goqqpsac3rbjd2onaaaa' because violates following content security policy directive: "default-src 'self'". note 'connect-src' not explicitly set, 'default-src' used fallback.

uncaught securityerror: failed construct 'websocket': refused connect 'ws://localhost:3000/browser-sync/socket.io/?eio=3&transport=websocket&sid=goqqpsac3rbjd2onaaaa' because violates document's content security policy.

how can overcome issue? can turn off security policy?

if csp set in html meta tag less ugly solution have browser-sync disable itself. adding browser-sync config should trick:

rewriterules: [   {       match: /content-security-policy/,       fn: function (match) {           return "disabled-content-security-policy";       }   } ], 

if you're smart inject correct csp rules permit browser-sync stuff. perhaps 1 diligent soul end writing plugin this?


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -