<p>Related Github Issue : <a href="https://github.com/kubernetes/ingress-nginx/issues/6519" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/issues/6519</a></p>
<pre><code>apiVersion: v1
data:
  server-snippet: |
    if ($http_x_azure_fdid !~* &quot;55ce4ed1-4b06-4bf1-b40e-4638452104da&quot; ) {
        return 403;
    }
  use-forwarded-headers: &quot;true&quot;
kind: ConfigMap
</code></pre>
<p>How to achieve the above config using helm when setting the values in the following approach?</p>
<pre><code>helm upgrade --install nginx-ingress-controller ingress-nginx/ingress-nginx \
    --namespace &quot;${namespace}&quot; \
    --version &quot;${chart_version}&quot; \
    --set controller.replicaCount=&quot;${replicas}&quot; \
    --set-string controller.config.use-forwarded-headers=true \
    --set-string controller.config.server-snippet=&lt;?&gt; \
    --debug
</code></pre>

Dhananjaya Senanayake
<p>You can define a multiline environment variable as below,</p>
<pre><code>read -d '' conf &lt;&lt; EOF
if ($http_x_azure_fdid !~* &quot;55ce4ed1-4b06-4bf1-b40e-4638452104da&quot; ) {
       return 403;
}
 EOF
</code></pre>
<p>Once the environment variable is defined, refer it in the helm <code>--set-string controller.config.server-snippet=</code> arg as below,</p>
<pre><code>helm upgrade --install nginx-ingress-controller ingress-nginx/ingress-nginx \
    --namespace &quot;${namespace}&quot; \
    --version &quot;${chart_version}&quot; \
    --set controller.replicaCount=&quot;${replicas}&quot; \
    --set-string controller.config.use-forwarded-headers=true \
    --set-string controller.config.server-snippet=$conf \
    --debug
</code></pre>
