Mix
Hot reload on a public domain
webpack.mix.js
mix.options({
hmr: false,
hmrOptions: {
host: String(process.env.APP_URL).split('://').pop(),
port: '443',
},
});
mix.browserSync({
files: [
'app/**',
'resources/**',
],
watchOptions: {
awaitWriteFinish: true,
},
proxy: {
target: 'http://127.0.0.1:8000',
proxyReq: [
function(proxyReq) {
proxyReq.setHeader('X-Forwarded-Host', String(process.env.APP_URL).split('://').pop());
},
],
},
socket: {
domain: String(process.env.APP_URL).split('://').pop(),
},
https: true,
reloadOnRestart: true,
open: false,
notify: false,
});
app/Http/Middleware/TrustProxies.php
protected $proxies = [
'127.0.0.1',
];
Start a PHP development server on http://localhost:8000
php artisan serve
Start a NPM development server on https://localhost:3000
npx mix watch --hot --https
Proxy the mix server on a custom domain using Valet
valet proxy <some site name> https://localhost:3000 --secure