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.

proxy not working with gulp

See original GitHub issue

When I run browser-sync with gulp it says it is proxying my server but it launches my site on the the same port. However when I manually start browser-sync, I get the expected behavior.

browsersync Here is my gupfile

var gulp = require('gulp'),
        browserSync = require('browser-sync'),
        reload = browserSync.reload;

var watchFiles = ['./views/**/*', './public/**/*'];

gulp.task('browser-sync', function() {
    browserSync.init(null, {
        proxy: "localhost:3000"
    });
});

gulp.task('watch', ['browser-sync'], function () {
  gulp.watch(watchFiles, reload);
});

gulp.task('default', ['watch']);

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sogkocommented, Aug 10, 2014

I recently had the same issue and in my case, I found out that my application is running at port 3000. same port for browser-sync by default

@makenova I noticed that your proxy is localhost:3000, try the following config to specify a different port for browser-sync to use

gulp.task('browser-sync', function() {
    browserSync({
        proxy: "localhost:3000",
        port: 4000 // specify a different port for browser-sync, default is 3000
    });
});

0reactions
shakyShanecommented, Aug 11, 2014

@makenova - BrowserSync just checks for an available port at run time, so it sounds like it’s losing in a race condition.

This is exactly what the port option is for, thanks to @sogko for pointing that out

😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 ......
Read more >
http-proxy-middleware - npm
Configure proxy middleware with ease for connect, express, browser-sync and many more. Powered by the popular Nodejitsu http-proxy . GitHub ...
Read more >
How to resolve NPM proxy issue whilel running node JS ...
'https://registry.npmjs.com/nodemon' is not a proxy, it is the target ... Then try to run your npm install command and it should work.
Read more >
How do I wire up Browsersync and Gulp in my Lando app?
# Configuring Lando for Browsersync · # Create the proxy · # Stream changes whenever Lando is running.
Read more >
Gulp Watch / BrowserSync Proxy not using port 3000 - sage
The EACCES error is a bit easier to fix. You most likely have some messed up permissions after running node / bower etc...
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