Cannot GET /route on refresh Angular Origin: On your device Last updated 15 Oct 2026

Angular (production): Cannot GET /dashboard — 404 when refreshing or opening a deep link

The web server only knows index.html; a direct request to /dashboard is not a file, so it returns 404 instead of letting Angular's router handle the URL.

Exact message you may see Cannot GET /dashboardCannot GET /route404 on refresh AngularThe requested URL was not found on this server Angular routeAngular deep link 404
Seen on: Angular Nginx Apache

Meaning

Angular is a single-page app: every path must return index.html and the router takes over in the browser. Configure the server (Nginx try_files, Apache rewrite, Express *, S3/CloudFront error document) to fall back to index.html, or use hash routing as a quick workaround.

Common causes

  • Nginx/Apache not configured with an SPA fallback
  • Express serving dist without a catch-all route
  • S3/CloudFront with no 403/404 → /index.html rewrite
  • Wrong <base href> in a sub-folder deployment
  • Firebase/Netlify/Vercel without a rewrite rule

⚡ Quick fix

  1. Add the fallback to index.html on your server
  2. Check <base href> matches the deployment path
  3. Temporary: provideRouter(routes, withHashLocation())

Detailed fix by platform

Nginx

  1. location / { try_files $uri $uri/ /index.html; }

Apache

  1. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.html [L]

Angular

  1. ng build --base-href /app/ when the app is not served from the domain root

Code examples

SPA fallback

nginx
server {
  root /var/www/app/browser;
  index index.html;
  location / {
    try_files $uri $uri/ /index.html;     # unknown paths go to Angular's router
  }
}

How to diagnose

  1. Server — Which web server serves the build?
  2. Fallback — Rule to index.html present?
  3. Base — Correct base href?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

404 — HTTP 404 Not Found (HTTP)404Cannot find control with name — Angular: Error: Cannot find control with name: 'email' (reactive forms) (Angular)Cannot find control w…exceeded maximum budget — Angular build: Error: bundle initial exceeded maximum budget. Budget 1.00 MB was not met by 120.00 kB with a total of 1.12 MB (Angular)exceeded maximum budg…NG04002 — Angular: NG04002: Cannot match any routes. URL Segment: 'x' (Angular)NG04002NG04014 — Angular: NG04014: Invalid configuration of route 'x': one of the following must be provided: component, loadComponent, redirectTo, children or loadChildren (Angular)NG04014NullInjectorError: No provider for ActivatedRoute! — Angular: NullInjectorError: No provider for ActivatedRoute! (also Router) — usually a unit test (Angular)NullInjectorError: No…Schema validation failed with the following errors — Angular CLI: Schema validation failed with the following errors: Data path "" must NOT have additional properties(xyz) (Angular)Schema validation fai…Cannot GE…

Explore the map of this error Full error map →

🧠 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.