<p>I have a kubernetes cluster, where I have deployed an nginx ingress controller using the <a href="https://github.com/helm/charts/tree/master/stable/nginx-ingress" rel="noreferrer">helm nginx-ingress chart</a>. </p>

<p>I need to add some custom config to the nginx.conf file that is generated in the nginx-controller-pod, and I am seeing an issue where if I add a one line option such as <code>proxy-buffer-size: "512k"</code> I can see this reflected in the nginx.conf file and everything works as expected.</p>

<p>However, if I attempt to add a snippet to accomplish the same thing:</p>

<pre><code>location-snippet: |
  proxy_buffer_size "512k";
</code></pre>

<p>It is as though this is ignored by the nginx.conf file and the <code>proxy_buffer_size</code> setting remains at it's default value. </p>

<p>I need to be able to add <code>http-snippet</code>, <code>server-snippet</code> and <code>location-snippet</code> overrides but whether I try to add them to the ConfigMap or as an annotation in the Ingress.yaml file they are always ignored.</p>

<p>My Ingress yaml file:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/ssl-redirect: "true" 
    ingress.kubernetes.io/secure-backends: "true"    
    ingress.kubernetes.io/force-ssl-redirect: "true"

    ingress.kubernetes.io/location-snippet: |
       proxy_buffer_size 512k;     --This does not update the nginx.conf
spec:
  tls:
  - hosts:
    - my.app.co.uk
    secretName: tls-secret

  rules:
  - host: my.app.co.uk
    http:
      paths:
      - path: /
        backend:
          serviceName: myappweb-service
          servicePort: 80
</code></pre>

<p>My nginx config map:</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app: nginx-ingress
    chart: nginx-ingress-0.28.3
    component: controller
    heritage: Tiller
    release: nginx-ingress
  name: nginx-ingress-controller
  namespace: default
data:
  proxy-buffer-size: "512k" -- this works and updates the nginx.conf

  location-snippet: |
    proxy_buffers 4 512k; -- this does not update the nginx.conf

  server-snippet: |       -- this does not update the nginx.conf
    location /messagehub {
      proxy_set_header Upgrade $http_upgrade;
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-Host $http_host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header Connection "upgrade";
      proxy_cache_bypass $http_upgrade;
   }
</code></pre>

Declan McNulty
<p>I spent a day untill got that for <strong>ingress-nginx</strong> (from Kubernetes) there are <code>*-snippet</code>, but for <strong>nginx-ingress</strong> (from NGINX) that <code>*-snippets</code> with <strong>s</strong>.</p>
<p>Look here:</p>
<ul>
<li>ingress-nginx: <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#main-snippet" rel="noreferrer">https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#main-snippet</a></li>
<li>nginx-ingress: <a href="https://docs.nginx.com/nginx-ingress-controller/configuration/global-configuration/configmap-resource/#snippets-and-custom-templates" rel="noreferrer">https://docs.nginx.com/nginx-ingress-controller/configuration/global-configuration/configmap-resource/#snippets-and-custom-templates</a></li>
</ul>
