Angular: Http failure response for http://…/api/x: 404 Not Found (HttpErrorResponse)
The API answered 404 — the URL is wrong (base URL, path or id), or the proxy/rewrite does not forward the request.
Http failure response for 404 Not Found404 Not Found HttpErrorResponseHttp failure response for http://localhost:4200/api/users: 404 Not FoundHttpErrorResponse status: 404ERROR HttpErrorResponse 404 Meaning
HttpClient throws HttpErrorResponse for 4xx/5xx. A 404 in Angular apps usually comes from a missing /api prefix, a wrong environment base URL, a dev proxy that does not rewrite the path, or hosting that serves index.html for unknown API paths. The error.url shows exactly which URL was called.
Common causes
- Wrong base URL or missing prefix (
/api) in the service - Environment file points at the wrong host or stage
- Dev proxy not forwarding or not rewriting the path
- Resource really does not exist (bad id)
- Route removed or renamed on the back end
⚡ Quick fix
- Log
error.urland compare it with the API docs - Check
environment.tsand the proxy config - Test the same URL with curl or Postman
Detailed fix by platform
Angular
this.http.get(${environment.apiUrl}/users/${id}).pipe(catchError(err => { console.error(err.url, err.status); return EMPTY; }))- Check
fileReplacementsin angular.json for production builds
Linux
curl -i https://api.example.com/users/7
How to diagnose
- URL — What is error.url?
- Env — Correct environment file used for this build?
- API — Does the endpoint exist?
🔧 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
- 404 HTTP 404 Not Found
- 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
- Http failure during parsing Angular: Http failure during parsing for http://…: SyntaxError: Unexpected token '<' (response is not JSON)
Most viewed in Angular
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 15 Oct 2026