Elliot Lings
Elliot Lings

Reputation: 1106

BrowserSync proxy to Homestead really slow

When using a proxy for BrowserSync it takes about 5-6s for requests to complete.

Gulp:

gulp.task('watch', function() {

    if (argv.serve) {
        browserSync.init({
            proxy: {
                target: argv.serve,
            }
        });
    }

    gulp.watch(paths.themes.sass, ['sass']);
});

I have tried the suggestion on this question: BrowserSync extremely slow but all my hosts are already setup as .dev.

I am running this locally. I have an hosts entry in /etc/hosts. Running OSX 10.10.3.

Upvotes: 2

Views: 999

Answers (1)

Elliot Lings
Elliot Lings

Reputation: 1106

I think there was an issue with my DNS.

The following gets around the issue:

gulp.task('watch', function() {

    if (argv.serve) {
        browserSync.init({
            proxy: {
                target: "192.168.10.10",
                reqHeaders: function (config) {
                    return {
                        "host": argv.serve,
                    }
                },
            }
        });
    }

    gulp.watch(paths.themes.sass, ['sass']);
});

Skipping the need to resolve host.

Upvotes: 0

Related Questions