HMR not working on clean install of Sage

Hi @graham,

Looks like you’re almost there! The redirect you’re experiencing now is coming from Valet.

Because your Valet site is secured, your upstream configuration needs to be HTTPS. Otherwise you’ll be redirected outside of the HMR server by Valet / Nginx. For example:

app
    .setUrl('http://localhost:3000')
    .setProxyUrl('https://roots.test')
    .watch(['resources/views', 'app']);

HMR SSL is optional, and it doesn’t really matter whether it’s enabled or disabled in terms of hot reloading.

The key things to remember are:

  • Bud’s HMR is proxying your local dev server. You set the upstream URL with setProxyUrl()
  • Bud’s HMR will rewrite any resources matching your setProxyUrl() to setUrl() (or setPublicProxyUrl() in non-standard configurations)
  • If your dev server is sending a HTTP → HTTPS redirect, this rewriting won’t take effect, and you’ll end up outside of the HMR server.

Hopefully that’ll get you up and running!

Tom

1 Like