How to Fix “localhost:5173 net::ERR_BLOCKED_BY_CLIENT”

Posted on

Vite Errors in Production: localhost:5173 net::ERR_BLOCKED_BY_CLIENT

If you’re seeing browser errors like, “GET http://localhost:5173/@vite/client net::ERR_BLOCKED_BY_CLIENT, on a live (production) Laravel site, you’re not alone. This issue is common when deploying Laravel apps that use Vite for asset bundling especially when React or Inertia.js is involved.

In this article, we’ll break down:

  • What causes this Vite-related production error
  • Why it loads from localhost:5173 even on production
  • How to fix it properly (with full steps)

Error Overview

When accessing your production domain (e.g., https://yourdomain.com), you may see the following errors in your browser console:

GET http://localhost:5173/@vite/client net::ERR_BLOCKED_BY_CLIENT
GET http://localhost:5173/resources/js/app.tsx net::ERR_BLOCKED_BY_CLIENT
GET http://localhost:5173/@react-refresh net::ERR_BLOCKED_BY_CLIENT

This means the browser tried to load JavaScript files from a development server (Vite) running at localhost:5173, but obviously, there is no such server in production.

What Causes This?

The root cause is a leftover file created by Vite during development:

public/hot

This file contains:

http://localhost:5173

Laravel uses this file to determine whether it should load assets via Vite’s development server (hot module reload mode). If this file exists, Laravel assumes you’re in dev mode and injects Vite’s dev scripts into the HTML.

Even if your .env says APP_ENV=production, Laravel will still try to load from localhost:5173 if public/hot exists.

How to Fix It?

1. Delete public/hot

Delete manually public/hot in your project (on the server) or you can use:

rm public/hot

2. Clear Laravel caches

run the following Artisan command:

php artisan optimize:clear

This clears any cached views, configs, and routes that might be referencing old state.

3. Refresh your browser

To force a full reload without cache:

  • Windows/Linux: Ctrl + Shift + R
  • Mac: Cmd + Shift + R

Or open your site in Incognito Mode.

Happy Coding!