I am trying to setup browser-sync to work via proxy:
gulp.task('browser-sync', function() {
browserSync({
notify: false,
browser: "chrome",
proxy:{
host:"localhost"
}
});
});
The problem is it seems cannot work with proxy directly, instead request for manually putting in snippet into website.
However, if I try with global browser-sync browser-sync start --proxy "localhost"
, it works.
How can I get the gulp browser-sync's proxy works? Or, how can I have the global browser-sync to work with gulp? It is important, so that browser-sync can work with my gulp logic and reload browser when needed.
According to the docs you should be using target
rather than host
.
proxy: {
target: "http://yourlocal.dev"
}
Or simply
proxy: "local.dev"
like @niba has in his answer