<p>I'm using an Nginx ingress controller to direct traffic to a specific service, although right now there is only one. The service points to a Node.js app, and the html returned from the server is always 304 not modified. Does anyone have any ideas as to how I can return 200 and prevent cache?</p>

<p>Here's my Ingress settings:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>apiVersion: networking.k8s.io/v1beta1 # for versions before 1.14 use extensions/v1beta1
kind: Ingress
metadata:
  name: kludge-ingress
  namespace: kludge
  annotations:
    # use the shared ingress-nginx
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
    - host: kludge.local
      http:
        paths:
          - path: /
            backend:
              serviceName: kludge-front-end
              servicePort: 80</code></pre>
</div>
</div>
</p>

<p>Service:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: kludge-front-end
  namespace: kludge
spec:
  type: NodePort
  selector:
    name: kludge-front-end
  ports:
    - name: http
      protocol: TCP
      nodePort: 30080
      port: 80
      targetPort: 3000</code></pre>
</div>
</div>
</p>

<p>Deployment:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: kludge-front-end
  namespace: kludge
spec:
  replicas: 3
  selector:
    matchLabels:
      name: kludge-front-end
  template:
      metadata:
        namespace: kludge
        labels:
          name: kludge-front-end
      spec:
        containers:
          - name: kludge-front-end
            image: gibson445/kludge-front-end
            ports:
              - containerPort: 3000
            imagePullPolicy: Never</code></pre>
</div>
</div>
</p>

<p><a href="https://i.stack.imgur.com/01G3x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/01G3x.png" alt="enter image description here"></a></p>

thatguyjono
<p>There's a pretty good chance you'd actually want <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#configuration-snippet" rel="nofollow noreferrer">configuration-snippet</a> to add the header Cache-Control.</p>

<p>Example: </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myingress
  namespace: mynamespace
  annotations:
    nginx.ingress.kubernetes.io/configuration-snippet: |
      add_header Cache-Control "max-age=0, no-cache, no-store, must-revalidate";
</code></pre>
