Browser: Cannot GET /users/42 — refreshing a Vue Router history-mode page returns 404
In history mode the server must serve index.html for all routes; otherwise direct URLs/refreshes hit non-existent files.
Cannot GET /users/42 Vue Router history mode refresh404 Not Found on refresh Vue RouterVue Router history mode 404 on page refreshVue SPA 404 after refresh nginxvue-router history mode not working in production Meaning
Add an SPA fallback: Nginx try_files $uri $uri/ /index.html;, Apache .htaccess rewrite to index.html, Netlify _redirects /* /index.html 200, Firebase rewrites, S3/CloudFront custom error response 404→200 /index.html. Or use createWebHashHistory. Set base if hosted in a subfolder.
Common causes
- Static server without fallback
- Wrong base (subdirectory deploy)
- Nginx try_files missing
- CDN returning 404 for unknown paths
- Assets requested relative to route path
⚡ Quick fix
- Nginx:
location / { try_files $uri $uri/ /index.html; } - Netlify
_redirects:/* /index.html 200 - Set
base/publicPathcorrectly or use hash history
Detailed fix by platform
Nginx
location / { root /var/www/app; try_files $uri $uri/ /index.html; }
How to diagnose
- Server — Fallback?
- Base — Subfolder?
- CDN — Error rewrite?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- [Vue Router warn]: No match found for location with path Vue Router: [Vue Router warn]: No match found for location with path "/users/42"
- ChunkLoadError ChunkLoadError: Loading chunk 123 failed.
- Could not find a production build in the '.next' directory Next.js: Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server
Most viewed in Vue
- Property was accessed during render but is not defined Vue: [Vue warn]: Property "x" was accessed during render but is not defined on instance
- Failed to resolve component Vue: [Vue warn]: Failed to resolve component: x
- Avoid mutating a prop directly Vue: [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026