# Ingress returns "404 Not Found" / "default backend - 404" (ingress-nginx)

**Code:** `default backend - 404` · **Category:** Kubernetes · **Seen on:** Kubernetes

The ingress controller received the request but no Ingress rule matched the host/path, so it answered with its default backend.

## Meaning

ingress-nginx serves a 404 page when the Host header or path doesn’t match any rule, the Ingress lacks the right ingressClassName (so this controller ignores it), or the path type/rewrite doesn’t match the URL.

## Common causes

- Missing or wrong ingressClassName (controller ignores the Ingress)
- Host in the rule differs from the requested host (www vs apex)
- pathType/Prefix vs Exact mismatch or missing rewrite
- Ingress in another namespace from the Service it references

## Quick fix

1. kubectl get ingress -A and check CLASS and HOSTS
2. Request with the exact host: curl -H 'Host: app.example.com'
3. Check controller logs for the request

## Detailed fix by platform

### YAML

1. 

```bash
spec:
  ingressClassName: nginx
  rules:
  - host: app.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend: { service: { name: web, port: { number: 80 } } }
```


## How to diagnose

1. **Class** — ingressClassName matches the controller?
2. **Host** — Exact match?
3. **Logs** — kubectl logs -n ingress-nginx deploy/ingress-nginx-controller

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/kubernetes/ingress-default-backend-404)
