0

My local dev environment (MBP) has apache running with a dynamic virtual host which allows me to have any project accessible via a consistent url structure: http://[client_name].[project_name].localhost

<Virtualhost *:80> VirtualDocumentRoot "/Users/mbp/repos/%1/websites/%2/public_html" ServerName sites.localhost ServerAlias *.*.localhost UseCanonicalName Off <Location /server-status> SetHandler server-status Order allow,deny Allow from all </Location> </Virtualhost> 

my package.json file includes a client and site key/value which is then imported into my gulpfile and makes these values accessible via pkg.client & pkg.site.

const { default: pkg } = await import("./package.json", { assert: { type: "json", }, }); 

My gulpfile.js inits browserSync

 browserSync.init({ notify: false, proxy: pkg.client + '.' + pkg.site + '.localhost' }); 

When I run gulp, it opens a new browser window to http://localhost:3000

If i'm on a wifi connection, this works flawlessly. If i'm on a tethered LTE connection (Mobile Data), it will not load. If i turn off wifi and have no internet connection, it will not load.

I've tried browsersync option online

To further clarify, this is all being accessed from the same machine. I'm not trying to connect to a browsersync session from a separate device.

Has anyone encountered this and have a fix?

3
  • 2
    "If i'm on a tethered LTE connection (Mobile Data), it will not load." - You seem to expect it to work - but please think about how it could possibly work considering it means that your computer is no-longer on the same network as your phone... (i.e. it won't work) - at least not until and unless you either get IPv6 working end-to-end - but as a stopgap you could run your own VPN tunnel back into your desktop's LAN... Commented Mar 6, 2024 at 0:47
  • My dev machine is my laptop which is just getting internet via wifi or LTE - both IPv4. Gulp / Browsersync is still running on the laptop with the browser trying to load localhost:3000 Commented Mar 7, 2024 at 1:50
  • If I turn off my wifi connection, localhost:3000 will not load but if I access my virtualhost client_name.project_name.localhost it loads fine. Commented Mar 7, 2024 at 2:38

1 Answer 1

0

It might be getting stuck trying to determine the network status - try forcing it offline first and see if that helps? https://browsersync.io/docs/options#option-online

Sign up to request clarification or add additional context in comments.

1 Comment

Unfortunately the online: false doesn't make any difference.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.