The issue you're encountering is due to Vite's development server serving assets over HTTP while your main site is being served over HTTPS. This results in mixed content errors because modern browsers block HTTP content on HTTPS pages for security reasons.
To resolve this, you need to ensure that Vite's server also uses HTTPS. You've already configured Vite to use HTTPS in your Vite config file, but you need to make sure that the HMR (Hot Module Replacement) connection is also using a secure protocol.
Here's what you can do:
- Update the
hmroption in your Vite configuration to usewss(WebSocket Secure) instead ofws. This will ensure that the WebSocket connection for HMR is also secure.
// Vite File
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.js',
ssr: 'resources/js/ssr.js',
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
server: {
https: true,
host: true,
port: 3009,
hmr: {
host: 'breezer.lndo.site',
protocol: 'wss', // Change 'ws' to 'wss'
},
},
});
-
Ensure that your Lando configuration forwards the correct HTTPS port for the Vite server. You've mapped port
3013to3009, but you need to make sure that the3013port is also served over HTTPS. -
If you're using a self-signed certificate for local development, you may need to configure your browser to trust the certificate, or you may need to add an exception for your local development domain.
-
Make sure that any environment variables or configurations that reference asset URLs are using
httpsas the protocol.
After making these changes, restart your Lando services and Vite server. Your assets should now be served over HTTPS, and the mixed content issue should be resolved. If you continue to experience issues, double-check your Lando proxy settings and ensure that all services are correctly configured to use HTTPS.