Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ollie_123's avatar

Vite Headache - Endless 404 in console

Hi All

I recently installed a new Laravel project and it now seems to have come with Vite instead of Webpack which is fine but the problem i'm getting is endless 404 errors in console and i can't seem to figure out how to fix it. I've gone through the laravel docs on Vite about working on a local server but still no joy.

Locally, I'm running Valet with the site secured over https Site is a multitenant / multisubdomain site. Have run npm run dev running else nothing compiles

And the endless 404 errors are as follows:-

[vite] connecting...
client.ts:22 WebSocket connection to 'wss://tenantsite.portal.app:3000/' failed: 
(anonymous) @ client.ts:22
client.ts:230 [vite] server connection lost. polling for restart...
VM9825:1          GET https://tenantsite.portal.app/__vite_ping 404
(anonymous) @ VM9825:1
waitForSuccessfulPing @ client.ts:214
(anonymous) @ client.ts:231
VM9825:1          GET https://tenantsite.portal.app/__vite_ping 404
etc etc

Any advice on how to fix would be much appreciated. Any questions, let me know.

Thank you in advance.

0 likes
6 replies
drehimself's avatar

Have you configured it to work with https: https://laravel.com/docs/9.x/vite#working-with-a-secure-development-server

If that doesn't work, maybe try getting it working without https first.

Also, make sure you have a somewhat recent version of Node. The Vite docs say at least Node 12.2.0 (https://vitejs.dev/guide/#scaffolding-your-first-vite-project) but some plugins require a later version. You can do node -v to check. I'm using v16.13.2 and all works well.

1 like
IainW's avatar

I'm getting the same thing . Running via valet with the secure development server set up as per the docs. Still getting endless 404s.

IainW's avatar

Fixed by visiting wss://myurl.test:3000 and accepting the certificate warning.

ollie_123's avatar

Hey @drehimself thanks for the response. I've tried as per the docs but still no joy.

@iainw, thanks for the response, i tried that but got a website couldnt be found. I'll keep digging.

thinkverse's avatar

Vite requires a valid certificate to create an HTTPS server, for users that don't have one you can use @vitejs/plugin-basic-ssl to create a self-signed certificate for development.

But Vite recommends creating your own certificate as per their documentation on serving with HTTPS.

npm install -D @vitejs/plugin-basic-ssl
import basicSsl from '@vitejs/plugin-basic-ssl'

export default defineConfig({
    plugins: [
        basicSsl(),
        ...
    ],
    server: {
        https: true,
        host: 'localhost',
    },
});

You still need to accept the self-signed certificate, which can be done by following the "Local" link as suggested by Laravel's documentation.

Please or to participate in this conversation.