Ali Gajani
Ali Gajani

Reputation: 15091

How to make Laravel Valet work nicely with BrowserSync?

Has anyone made Laravel Valet (secure) work nicely with Browser Sync while using Laravel Mix. I am doing something like this but it keeps pointing me to https://shadow-api.test:3000 where as I simply want to omit the port.

mix.browserSync({
    proxy: 'shadow-api.test',
    host: 'shadow-api.test',
    open: 'external',
    https: {
        key: "/Users/aligajani/.config/valet/Certificates/shadow-api.test.key",
        cert: "/Users/aligajani/.config/valet/Certificates/shadow-api.test.crt"
    }
});

For your information, I am using the latest versions of everything, fresh install and intend on building a SPA (with token auth). I haven't had similar issues with BrowserSync before simply because I wasn't using Valet.

Upvotes: 1

Views: 429

Answers (1)

Brotzka
Brotzka

Reputation: 2785

Better late than never.. this works for me:

.browserSync({
    proxy: 'https://mass-importer.faaren.test',
    host: 'mass-importer.faaren.test',
    open: 'external',
    https: {
        key: "/Users/fabianhagen/.config/valet/Certificates/mass-importer.faaren.test.key",
        cert: "/Users/fabianhagen/.config/valet/Certificates/mass-importer.faaren.test.crt"
    }
});

I had to prefix the proxy domain with https://. It still opens under port 3000 (or another if this port is already used), but browsersync is working.

Upvotes: 1

Related Questions