Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proxy URL not working with BrowserSync Gulp task

Can someone tell me why my proxy URL isn't working with BrowserSync and Gulp? Instead, it just keeps using http://localhost:3000 as the dev URL.

gulp.task('watch', ['bs'], function() {
  gulp.watch('scss/*.scss', ['scss', browserSync.reload]);
});

gulp.task('bs', function() {
    browserSync.init(['css/style1.css', 'css/style2.css'], {
      proxy: 'dev.site.com'
    });
});

gulp.task('default', ['scss', 'watch']);
like image 429
Cofey Avatar asked Feb 17 '15 17:02

Cofey


1 Answers

I had the same problem and did the following to stop browser-sync from using the default adress/port:

gulp.task('bs', function () {
    browserSync.init(null, {
        proxy: 'localhost:8080', // 'dev.site.com' in your example
        port: 5000
    });
});

This worked for me and change the browser-scyn adress to localhost:5000

like image 200
Maximilian Lindsey Avatar answered Sep 18 '22 16:09

Maximilian Lindsey