title: Routing issues with nginx ingress controller and basic django app
body: <p>EDIT: I rewrote the question with a fully reproducible example.</p>
  <p>I have a sample Django app with the base getting started <a href="https://docs.djangoproject.com/en/3.2/intro/tutorial01/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/3.2/intro/tutorial01/</a>, that is, there are two paths <code>/admin</code> and <code>/polls</code>.</p>
  <p>If I deploy the app using NodePort, I can access both paths without issues. However, I haven't managed to do the same with Nginx ingress controller. I have tried several combinations of annotations and paths to no avail.</p>
  <p>So, assume this yaml:</p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    labels:
      app: django
    name: django
  spec:
    selector:
      matchLabels:
        app: django
    template:
      metadata:
        labels:
          app: django
      spec:
        containers:
        - image: &quot;ay0o/django-ingress:latest&quot;
          name: django
  # ---
  # apiVersion: v1
  # kind: Service
  # metadata:
  #   name: django
  # spec:
  #   ports:
  #   - nodePort: 31000
  #     port: 8000
  #     targetPort: 8000
  #   selector:
  #     app: django
  #   type: NodePort
  ---
  apiVersion: v1
  kind: Service
  metadata:
    name: django
  spec:
    ports:
    - port: 8000
    selector:
      app: django
  ---
  apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: django
  spec:
    rules:
    - http:
        paths:
        - path: /django
          pathType: Prefix
          backend:
            service:
              name: django
              port:
                number: 8000
  
  </code></pre>
  <p>when I use NodePort, <code>http://localhost:31000/admin</code> and <code>http://localhost:31000/polls</code> work fine.</p>
  <p>when I use Ingress, <code>http://localhost/django</code> returns a 404 from django (because the path is neither admin nor polls), but <code>http://localhost/django/admin</code> and <code>http://localhost/django/polls</code> return a 404 from nginx, meaning the ingress is not properly routing.</p>
  <p>so, what should I change so that <code>http://localhost/django/admin</code> and <code>http://localhost/django/polls</code> will not return 404?</p>