Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy config doesn't work with "localhost" it only works with "127.0.0.1" #1979

Open
2 of 10 tasks
NathanBowers opened this issue Nov 4, 2022 · 3 comments
Open
2 of 10 tasks

Comments

@NathanBowers
Copy link

Issue details

Documentation says that proxy: 'localhost:4567' will work.
In the past it did work but as of now localhost doesn't work and I have to use proxy: '120.0.0.1:4567' instead.
I'm using Ruby Middleman static site generator with gulp to build static assets and startup BrowserSync.

If I gulp config proxy: 'localhost:4567' the BrowserSync UI server starts ok but trying to browse to localhost:7000 hangs as if no server is started there. I can browse the Middleman server at localhost:4567fine, it's just not being proxied.

I don't mind using an IP address instead of localhost, but the documentation all says that localhost works and this was a breaking change after I recently upgraded all my node packages, gems, ruby, and macOS.

Steps to reproduce/test case

My simplified gulp file init:

  browsersync.init({
    proxy: "localhost:4567",  // <-- "localhost" doesn't work. When I change it to 127.0.0.1:4567 it does work
    port: 7000,     				
     ui: {
       port: 7001				
       }
  });

The full codebase is at https://github.com/NathanBowers/mm-template if that helps.

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

  • Browsersync [ 2.27.10 ]
  • Node [ 19.0.0 ]
  • Npm [ 8.19.2 ]

Affected platforms

  • linux
  • windows
  • OS X Ventura 13.0
  • freebsd
  • solaris
  • other (please specify which)

Browsersync use-case

  • API
  • Gulp 4.0.2
  • Grunt
  • CLI

If CLI, please paste the entire command below

{cli command here}

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

Here's the init from my gulp file:

function browserSync(done) {
  browsersync.init({
    notify: true,					
    ghostMode: true,				
    open: true, 					
    reloadOnRestart: true,
    proxy: "localhost:4567",  // <-- "localhost" doesn't work. When I change it to 127.0.0.1:4567 it does work
    port: 7000,     				
     ui: {
       port: 7001				
       }
  });
  done();
}

The full codebase is at https://github.com/NathanBowers/mm-template if that helps.

@homestar9
Copy link

Can confirm this issue exists on my machine as well. The docs should be updated if you can no longer use localhost and instead must use 127.0.0.1 instead.

@paulmsmith
Copy link

I've bumped into this issue. I can confirm not using not using localhost but instead using 127.0.0.1 also worked for me.

Is this a browsersync issue? I thought it might be something related to a new router I've added with DNS rebind protection enabled or perhaps an update to MacOS?

@RileySeaburg
Copy link

This is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants