question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connecting to BrowserSync proxy over anything but *.dev is timing out

See original GitHub issue

Issue details

Hello, Since Chrome now forces *.dev to HTTPS, I’ve had to change my local development URLs to *.test. However, I’m now having an issue “connection” to a proxy’d site over anything that isn’t *.dev. I’ve switched to FireFox for testing this.

Thank you all for your time!

Steps to reproduce/test case

WORKS: npm install -g browser-sync browser-sync start --proxy "wp2.dev"

DOESN’T WORK: npm install -g browser-sync browser-sync start --proxy "wp2.test"

The BrowserSync server starts quickly (and takes the same time) in both cases; it’s getting the browser to actually connect to the server that’s taking forever (and timing out) in the non-.dev case.

Please specify which version of Browsersync, node and npm you’re running

  • Browsersync [ 2.18.12 ]
  • Node [ 6.10.3 ]
  • Npm [ 3.10.10 ]

Affected platforms

  • linux (Ubuntu 16.04)
  • windows
  • OS X
  • freebsd
  • solaris
  • other (please specify which)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • CLI

If CLI, please paste the entire command

browser-sync start --proxy "wp2.test"

for all other use-cases, (gulp, grunt etc), please show us exactly how you’re using Browsersync

gulp:

/**
 * Gulp Tasks
 *
 * @since 1.0.0
 */

/**
 * SET BROSWERSYNC URL
 */
var bs_url = "http://wp2.test/";

/**
 * Grab gulp packages
 */
var gulp  = require('gulp'),
    gutil = require('gulp-util'),
    sass = require('gulp-sass'),
    cssnano = require('gulp-cssnano'),
    autoprefixer = require('gulp-autoprefixer'),
    sourcemaps = require('gulp-sourcemaps'),
    jshint = require('gulp-jshint'),
    stylish = require('jshint-stylish'),
    uglify = require('gulp-uglify'),
    concat = require('gulp-concat'),
    rename = require('gulp-rename'),
    plumber = require('gulp-plumber'),
    bower = require('gulp-bower'),
    babel = require('gulp-babel'),
    browserSync = require('browser-sync').create();


/**
 * Compile, autoprefix, and minify SASS
 */
gulp.task('styles', function() {
    return gulp.src('./assets/scss/**/*.scss')
        .pipe(plumber(function(error) {
            gutil.log(gutil.colors.red(error.message));
            this.emit('end');
        }))
        .pipe(sourcemaps.init()) // Start Sourcemaps
        .pipe(sass())
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(gulp.dest('./assets/css/'))
        .pipe(rename({suffix: '.min'}))
        .pipe(cssnano())
        .pipe(sourcemaps.write('.')) // Creates sourcemaps for minified styles
        .pipe(gulp.dest('./assets/css/'))
});


/**
 * JShint, concat, and minify head JS
 */
gulp.task('site-js-head', function() {

  return gulp.src([
    './assets/js/head/*.js'
  ])
    .pipe(plumber())
    .pipe(sourcemaps.init())
    .pipe(jshint())
    .pipe(jshint.reporter('jshint-stylish'))
    .pipe(concat('head.js'))
    .pipe(gulp.dest('./assets/js'))
    .pipe(rename({suffix: '.min'}))
    .pipe(uglify())
    .pipe(sourcemaps.write('.')) // Creates sourcemap for minified JS
    .pipe(gulp.dest('./assets/js'))
});


/**
 * JShint, concat, and minify foot JS
 */
gulp.task('site-js-foot', function() {

  return gulp.src([
    './assets/js/foot/*.js'
  ])
    .pipe(plumber())
    .pipe(sourcemaps.init())
    .pipe(jshint())
    .pipe(jshint.reporter('jshint-stylish'))
    .pipe(concat('foot.js'))
    .pipe(gulp.dest('./assets/js'))
    .pipe(rename({suffix: '.min'}))
    .pipe(uglify())
    .pipe(sourcemaps.write('.')) // Creates sourcemap for minified JS
    .pipe(gulp.dest('./assets/js'))
});


/**
 * BrowserSync Config
 */
gulp.task('browsersync', function() {

    // Watch files
    var files = [
    	'./assets/css/*.css',
    	'./assets/js/*.js',
    	'**/*.php',
    	'assets/images/**/*.{png,jpg,gif,svg,webp}'
    ];

    browserSync.init(files, {
	    proxy: bs_url,
		  open: false,
    });

    gulp.watch('./assets/scss/**/*.scss', ['styles']);
    gulp.watch('./assets/js/head/*.js', ['site-js-head']).on('change', browserSync.reload);
    gulp.watch('./assets/js/foot/*.js', ['site-js-foot']).on('change', browserSync.reload);
});


/**
 * Non-Browsersync JS/SASS watch
 */
gulp.task('watch', function() {

  // Watch .scss files
  gulp.watch('./assets/scss/**/*.scss', ['styles']);

  // Watch js files
  gulp.watch('./assets/js/head/*.js', ['site-js-head']);
  gulp.watch('./assets/js/foot/*.js', ['site-js-foot']);
});


/**
 * Default: Run style and js tasks
 */
gulp.task('default', function() {
  gulp.start('styles', 'site-js-head', 'site-js-foot');
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
paulgoodfieldcommented, Jan 8, 2018

Having exactly the same issue. Following Chrome’s recent update forcing *.dev domains to https, I started using *.local domains when developing. Using this type of domain for the proxy causes BrowserSync to timeout when loading any page.

0reactions
neilgeecommented, Jan 19, 2018

hmmm - I now see it working on another .test domain on my local environment - so for me its inconsistent - will test on a number of domains and see If i can verify a pattern.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BrowserSync proxy stuck loading - gulp - Stack Overflow
I'm using WAMP on Windows 10, Gulp version 3.9.1, BrowserSync version 2.24.4. This setup was working fine until recently, this has me stumped....
Read more >
Browsersync options
Browsersync makes your browser testing workflow faster by synchronising URLs, interactions and code changes across multiple devices.
Read more >
BrowserSync not refreshing - Laracasts
For some reason I can't get BrowserSync to refresh when I update my files. Upon running gulp watch the connection gets initialised so...
Read more >
You should start using Browsersync today. - Donny Wals
Browsersync is a great tool that allows you to sync your browser on ... I can refresh all connected browsers whenever my css...
Read more >
Using BrowserSync for Debugging your localhost
Skipping over a couple of painful (but short) years of writing custom ... all the headaches associated with web development, saving me both...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found