Deploy GitHub Pages

This commit is contained in:
Travis Bot 2020-02-09 23:53:05 +00:00
parent ec2af1dbc3
commit 006cda8fee
62 changed files with 1885 additions and 1843 deletions

View file

@ -34,7 +34,7 @@
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link rel="shortcut icon" href="../../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.4.3">
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.6.2">
@ -42,7 +42,7 @@
<link rel="stylesheet" href="../../../assets/stylesheets/application.30686662.css">
<link rel="stylesheet" href="../../../assets/stylesheets/application.adb8469c.css">
<link rel="stylesheet" href="../../../assets/stylesheets/application-palette.a8b3c06d.css">
@ -53,12 +53,12 @@
<script src="../../../assets/javascripts/modernizr.74668098.js"></script>
<script src="../../../assets/javascripts/modernizr.86422ebf.js"></script>
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono&display=fallback">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
@ -114,7 +114,7 @@
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#annotations" tabindex="1" class="md-skip">
<a href="#annotations" tabindex="0" class="md-skip">
Skip to content
</a>
@ -123,7 +123,7 @@
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="https://kubernetes.github.io/ingress-nginx" title="NGINX Ingress Controller" class="md-header-nav__button md-logo">
<a href="https://kubernetes.github.io/ingress-nginx" title="NGINX Ingress Controller" aria-label="NGINX Ingress Controller" class="md-header-nav__button md-logo">
<i class="md-icon">public</i>
@ -154,7 +154,7 @@
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
<input type="text" class="md-search__input" aria-label="search" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
&#xE5CD;
@ -1965,13 +1965,13 @@
<p class="admonition-title">Tip</p>
<p>Annotation keys and values can only be strings.
Other types, such as boolean or numeric values must be quoted,
i.e. <code class="codehilite">&quot;true&quot;</code>, <code class="codehilite">&quot;false&quot;</code>, <code class="codehilite">&quot;100&quot;</code>.</p>
i.e. <code class="codehilite"><span class="err">&quot;true&quot;</span></code>, <code class="codehilite"><span class="err">&quot;false&quot;</span></code>, <code class="codehilite"><span class="err">&quot;100&quot;</span></code>.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The annotation prefix can be changed using the
<a href="../../cli-arguments/"><code class="codehilite">--annotations-prefix</code> command line argument</a>,
but the default is <code class="codehilite">nginx.ingress.kubernetes.io</code>, as described in the
<a href="../../cli-arguments/"><code class="codehilite"><span class="err">--annotations-prefix</span></code> command line argument</a>,
but the default is <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io</span></code>, as described in the
table below.</p>
</div>
<table>
@ -2405,71 +2405,71 @@ table below.</p>
</tbody>
</table>
<h3 id="canary">Canary<a class="headerlink" href="#canary" title="Permanent link"></a></h3>
<p>In some cases, you may want to "canary" a new set of changes by sending a small number of requests to a different service than the production service. The canary annotation enables the Ingress spec to act as an alternative service for requests to route to depending on the rules applied. The following annotations to configure canary can be enabled after <code class="codehilite">nginx.ingress.kubernetes.io/canary: &quot;true&quot;</code> is set:</p>
<p>In some cases, you may want to "canary" a new set of changes by sending a small number of requests to a different service than the production service. The canary annotation enables the Ingress spec to act as an alternative service for requests to route to depending on the rules applied. The following annotations to configure canary can be enabled after <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/canary: &quot;true&quot;</span></code> is set:</p>
<ul>
<li>
<p><code class="codehilite">nginx.ingress.kubernetes.io/canary-by-header</code>: The header to use for notifying the Ingress to route the request to the service specified in the Canary Ingress. When the request header is set to <code class="codehilite">always</code>, it will be routed to the canary. When the header is set to <code class="codehilite">never</code>, it will never be routed to the canary. For any other value, the header will be ignored and the request compared against the other canary rules by precedence.</p>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/canary-by-header</span></code>: The header to use for notifying the Ingress to route the request to the service specified in the Canary Ingress. When the request header is set to <code class="codehilite"><span class="err">always</span></code>, it will be routed to the canary. When the header is set to <code class="codehilite"><span class="err">never</span></code>, it will never be routed to the canary. For any other value, the header will be ignored and the request compared against the other canary rules by precedence.</p>
</li>
<li>
<p><code class="codehilite">nginx.ingress.kubernetes.io/canary-by-header-value</code>: The header value to match for notifying the Ingress to route the request to the service specified in the Canary Ingress. When the request header is set to this value, it will be routed to the canary. For any other header value, the header will be ignored and the request compared against the other canary rules by precedence. This annotation has to be used together with . The annotation is an extension of the <code class="codehilite">nginx.ingress.kubernetes.io/canary-by-header</code> to allow customizing the header value instead of using hardcoded values. It doesn't have any effect if the <code class="codehilite">nginx.ingress.kubernetes.io/canary-by-header</code> annotation is not defined.</p>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/canary-by-header-value</span></code>: The header value to match for notifying the Ingress to route the request to the service specified in the Canary Ingress. When the request header is set to this value, it will be routed to the canary. For any other header value, the header will be ignored and the request compared against the other canary rules by precedence. This annotation has to be used together with . The annotation is an extension of the <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/canary-by-header</span></code> to allow customizing the header value instead of using hardcoded values. It doesn't have any effect if the <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/canary-by-header</span></code> annotation is not defined.</p>
</li>
<li>
<p><code class="codehilite">nginx.ingress.kubernetes.io/canary-by-cookie</code>: The cookie to use for notifying the Ingress to route the request to the service specified in the Canary Ingress. When the cookie value is set to <code class="codehilite">always</code>, it will be routed to the canary. When the cookie is set to <code class="codehilite">never</code>, it will never be routed to the canary. For any other value, the cookie will be ignored and the request compared against the other canary rules by precedence.</p>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/canary-by-cookie</span></code>: The cookie to use for notifying the Ingress to route the request to the service specified in the Canary Ingress. When the cookie value is set to <code class="codehilite"><span class="err">always</span></code>, it will be routed to the canary. When the cookie is set to <code class="codehilite"><span class="err">never</span></code>, it will never be routed to the canary. For any other value, the cookie will be ignored and the request compared against the other canary rules by precedence.</p>
</li>
<li>
<p><code class="codehilite">nginx.ingress.kubernetes.io/canary-weight</code>: The integer based (0 - 100) percent of random requests that should be routed to the service specified in the canary Ingress. A weight of 0 implies that no requests will be sent to the service in the Canary ingress by this canary rule. A weight of 100 means implies all requests will be sent to the alternative service specified in the Ingress.</p>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/canary-weight</span></code>: The integer based (0 - 100) percent of random requests that should be routed to the service specified in the canary Ingress. A weight of 0 implies that no requests will be sent to the service in the Canary ingress by this canary rule. A weight of 100 means implies all requests will be sent to the alternative service specified in the Ingress.</p>
</li>
</ul>
<p>Canary rules are evaluated in order of precedence. Precedence is as follows:
<code class="codehilite">canary-by-header -&gt; canary-by-cookie -&gt; canary-weight</code></p>
<p><strong>Note</strong> that when you mark an ingress as canary, then all the other non-canary annotations will be ignored (inherited from the corresponding main ingress) except <code class="codehilite">nginx.ingress.kubernetes.io/load-balance</code> and <code class="codehilite">nginx.ingress.kubernetes.io/upstream-hash-by</code>.</p>
<code class="codehilite"><span class="err">canary-by-header -&gt; canary-by-cookie -&gt; canary-weight</span></code></p>
<p><strong>Note</strong> that when you mark an ingress as canary, then all the other non-canary annotations will be ignored (inherited from the corresponding main ingress) except <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/load-balance</span></code> and <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/upstream-hash-by</span></code>.</p>
<p><strong>Known Limitations</strong></p>
<p>Currently a maximum of one canary ingress can be applied per Ingress rule.</p>
<h3 id="rewrite">Rewrite<a class="headerlink" href="#rewrite" title="Permanent link"></a></h3>
<p>In some scenarios the exposed URL in the backend service differs from the specified path in the Ingress rule. Without a rewrite any request will return 404.
Set the annotation <code class="codehilite">nginx.ingress.kubernetes.io/rewrite-target</code> to the path expected by the service.</p>
<p>If the Application Root is exposed in a different path and needs to be redirected, set the annotation <code class="codehilite">nginx.ingress.kubernetes.io/app-root</code> to redirect requests for <code class="codehilite">/</code>.</p>
Set the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/rewrite-target</span></code> to the path expected by the service.</p>
<p>If the Application Root is exposed in a different path and needs to be redirected, set the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/app-root</span></code> to redirect requests for <code class="codehilite"><span class="err">/</span></code>.</p>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p>Please check the <a href="../../../examples/rewrite/">rewrite</a> example.</p>
</div>
<h3 id="session-affinity">Session Affinity<a class="headerlink" href="#session-affinity" title="Permanent link"></a></h3>
<p>The annotation <code class="codehilite">nginx.ingress.kubernetes.io/affinity</code> enables and sets the affinity type in all Upstreams of an Ingress. This way, a request will always be directed to the same upstream server.
The only affinity type available for NGINX is <code class="codehilite">cookie</code>.</p>
<p>The annotation <code class="codehilite">nginx.ingress.kubernetes.io/affinity-mode</code> defines the stickyness of a session. Setting this to <code class="codehilite">balanced</code> (default) will redistribute some sessions if a deployment gets scaled up, therefore rebalancing the load on the servers. Setting this to <code class="codehilite">persistent</code> will not rebalance sessions to new servers, therefore providing maximum stickyness.</p>
<p>The annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/affinity</span></code> enables and sets the affinity type in all Upstreams of an Ingress. This way, a request will always be directed to the same upstream server.
The only affinity type available for NGINX is <code class="codehilite"><span class="err">cookie</span></code>.</p>
<p>The annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/affinity-mode</span></code> defines the stickyness of a session. Setting this to <code class="codehilite"><span class="err">balanced</span></code> (default) will redistribute some sessions if a deployment gets scaled up, therefore rebalancing the load on the servers. Setting this to <code class="codehilite"><span class="err">persistent</span></code> will not rebalance sessions to new servers, therefore providing maximum stickyness.</p>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>If more than one Ingress is defined for a host and at least one Ingress uses <code class="codehilite">nginx.ingress.kubernetes.io/affinity: cookie</code>, then only paths on the Ingress using <code class="codehilite">nginx.ingress.kubernetes.io/affinity</code> will use session cookie affinity. All paths defined on other Ingresses for the host will be load balanced through the random selection of a backend server.</p>
<p>If more than one Ingress is defined for a host and at least one Ingress uses <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/affinity: cookie</span></code>, then only paths on the Ingress using <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/affinity</span></code> will use session cookie affinity. All paths defined on other Ingresses for the host will be load balanced through the random selection of a backend server.</p>
</div>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p>Please check the <a href="../../../examples/affinity/cookie/">affinity</a> example.</p>
</div>
<h4 id="cookie-affinity">Cookie affinity<a class="headerlink" href="#cookie-affinity" title="Permanent link"></a></h4>
<p>If you use the <code class="codehilite">cookie</code> affinity type you can also specify the name of the cookie that will be used to route the requests with the annotation <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-name</code>. The default is to create a cookie named 'INGRESSCOOKIE'.</p>
<p>The NGINX annotation <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-path</code> defines the path that will be set on the cookie. This is optional unless the annotation <code class="codehilite">nginx.ingress.kubernetes.io/use-regex</code> is set to true; Session cookie paths do not support regex.</p>
<p>Use <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-samesite</code> to apply a <code class="codehilite">SameSite</code> attribute to the sticky cookie. Browser accepted values are <code class="codehilite">None</code>, <code class="codehilite">Lax</code>, and <code class="codehilite">Strict</code>. Some older browsers reject cookies with the more-recently-defined <code class="codehilite">SameSite=None</code>. To omit <code class="codehilite">SameSite=None</code> from these older browsers, add the annotation <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-conditional-samesite-none: &quot;true&quot;</code>.</p>
<p>If you use the <code class="codehilite"><span class="err">cookie</span></code> affinity type you can also specify the name of the cookie that will be used to route the requests with the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/session-cookie-name</span></code>. The default is to create a cookie named 'INGRESSCOOKIE'.</p>
<p>The NGINX annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/session-cookie-path</span></code> defines the path that will be set on the cookie. This is optional unless the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/use-regex</span></code> is set to true; Session cookie paths do not support regex.</p>
<p>Use <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/session-cookie-samesite</span></code> to apply a <code class="codehilite"><span class="err">SameSite</span></code> attribute to the sticky cookie. Browser accepted values are <code class="codehilite"><span class="err">None</span></code>, <code class="codehilite"><span class="err">Lax</span></code>, and <code class="codehilite"><span class="err">Strict</span></code>. Some older browsers reject cookies with the more-recently-defined <code class="codehilite"><span class="err">SameSite=None</span></code>. To omit <code class="codehilite"><span class="err">SameSite=None</span></code> from these older browsers, add the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/session-cookie-conditional-samesite-none: &quot;true&quot;</span></code>.</p>
<h3 id="authentication">Authentication<a class="headerlink" href="#authentication" title="Permanent link"></a></h3>
<p>Is possible to add authentication adding additional annotations in the Ingress rule. The source of the authentication is a secret that contains usernames and passwords.</p>
<p>The annotations are:
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-type: [basic|digest]
</pre></div></p>
<div class="codehilite"><pre><span></span><code><span class="err">nginx.ingress.kubernetes.io/auth-type: [basic|digest]</span>
</code></pre></div></p>
<p>Indicates the <a href="https://tools.ietf.org/html/rfc2617">HTTP Authentication Type: Basic or Digest Access Authentication</a>.</p>
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-secret: secretName
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="err">nginx.ingress.kubernetes.io/auth-secret: secretName</span>
</code></pre></div>
<p>The name of the Secret that contains the usernames and passwords which are granted access to the <code class="codehilite">path</code>s defined in the Ingress rules.
<p>The name of the Secret that contains the usernames and passwords which are granted access to the <code class="codehilite"><span class="err">path</span></code>s defined in the Ingress rules.
This annotation also accepts the alternative form "namespace/secretName", in which case the Secret lookup is performed in the referenced namespace instead of the Ingress namespace.</p>
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-secret-type: [auth-file|auth-map]
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="err">nginx.ingress.kubernetes.io/auth-secret-type: [auth-file|auth-map]</span>
</code></pre></div>
<p>The <code class="codehilite">auth-secret</code> can have two forms:</p>
<p>The <code class="codehilite"><span class="err">auth-secret</span></code> can have two forms:</p>
<ul>
<li><code class="codehilite">auth-file</code> - default, an htpasswd file in the key <code class="codehilite">auth</code> within the secret</li>
<li><code class="codehilite">auth-map</code> - the keys of the secret are the usernames, and the values are the hashed passwords</li>
<li><code class="codehilite"><span class="err">auth-file</span></code> - default, an htpasswd file in the key <code class="codehilite"><span class="err">auth</span></code> within the secret</li>
<li><code class="codehilite"><span class="err">auth-map</span></code> - the keys of the secret are the usernames, and the values are the hashed passwords</li>
</ul>
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-realm: &quot;realm string&quot;
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="err">nginx.ingress.kubernetes.io/auth-realm: &quot;realm string&quot;</span>
</code></pre></div>
<div class="admonition example">
<p class="admonition-title">Example</p>
@ -2479,30 +2479,30 @@ This annotation also accepts the alternative form "namespace/secretName", in whi
<p>NGINX supports load balancing by client-server mapping based on <a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#hash">consistent hashing</a> for a given key. The key can contain text, variables or any combination thereof. This feature allows for request stickiness other than client IP or cookies. The <a href="http://www.last.fm/user/RJ/journal/2007/04/10/392555/">ketama</a> consistent hashing method will be used which ensures only a few keys would be remapped to different servers on upstream group changes.</p>
<p>There is a special mode of upstream hashing called subset. In this mode, upstream servers are grouped into subsets, and stickiness works by mapping keys to a subset instead of individual upstream servers. Specific server is chosen uniformly at random from the selected sticky subset. It provides a balance between stickiness and load distribution.</p>
<p>To enable consistent hashing for a backend:</p>
<p><code class="codehilite">nginx.ingress.kubernetes.io/upstream-hash-by</code>: the nginx variable, text value or any combination thereof to use for consistent hashing. For example <code class="codehilite">nginx.ingress.kubernetes.io/upstream-hash-by: &quot;$request_uri&quot;</code> to consistently hash upstream requests by the current request URI.</p>
<p>"subset" hashing can be enabled setting <code class="codehilite">nginx.ingress.kubernetes.io/upstream-hash-by-subset</code>: "true". This maps requests to subset of nodes instead of a single one. <code class="codehilite">upstream-hash-by-subset-size</code> determines the size of each subset (default 3).</p>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/upstream-hash-by</span></code>: the nginx variable, text value or any combination thereof to use for consistent hashing. For example <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/upstream-hash-by: &quot;$request_uri&quot;</span></code> to consistently hash upstream requests by the current request URI.</p>
<p>"subset" hashing can be enabled setting <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/upstream-hash-by-subset</span></code>: "true". This maps requests to subset of nodes instead of a single one. <code class="codehilite"><span class="err">upstream-hash-by-subset-size</span></code> determines the size of each subset (default 3).</p>
<p>Please check the <a href="../../../examples/chashsubset/deployment.yaml">chashsubset</a> example.</p>
<h3 id="custom-nginx-load-balancing">Custom NGINX load balancing<a class="headerlink" href="#custom-nginx-load-balancing" title="Permanent link"></a></h3>
<p>This is similar to <a href="../configmap/#load-balance"><code class="codehilite">load-balance</code> in ConfigMap</a>, but configures load balancing algorithm per ingress.</p>
<p>This is similar to <a href="../configmap/#load-balance"><code class="codehilite"><span class="err">load-balance</span></code> in ConfigMap</a>, but configures load balancing algorithm per ingress.</p>
<blockquote>
<p>Note that <code class="codehilite">nginx.ingress.kubernetes.io/upstream-hash-by</code> takes preference over this. If this and <code class="codehilite">nginx.ingress.kubernetes.io/upstream-hash-by</code> are not set then we fallback to using globally configured load balancing algorithm.</p>
<p>Note that <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/upstream-hash-by</span></code> takes preference over this. If this and <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/upstream-hash-by</span></code> are not set then we fallback to using globally configured load balancing algorithm.</p>
</blockquote>
<h3 id="custom-nginx-upstream-vhost">Custom NGINX upstream vhost<a class="headerlink" href="#custom-nginx-upstream-vhost" title="Permanent link"></a></h3>
<p>This configuration setting allows you to control the value for host in the following statement: <code class="codehilite">proxy_set_header Host $host</code>, which forms part of the location block. This is useful if you need to call the upstream server by something other than <code class="codehilite">$host</code>.</p>
<p>This configuration setting allows you to control the value for host in the following statement: <code class="codehilite"><span class="err">proxy_set_header Host $host</span></code>, which forms part of the location block. This is useful if you need to call the upstream server by something other than <code class="codehilite"><span class="err">$host</span></code>.</p>
<h3 id="client-certificate-authentication">Client Certificate Authentication<a class="headerlink" href="#client-certificate-authentication" title="Permanent link"></a></h3>
<p>It is possible to enable Client Certificate Authentication using additional annotations in Ingress Rule.</p>
<p>The annotations are:</p>
<ul>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-secret: secretName</code>:
The name of the Secret that contains the full Certificate Authority chain <code class="codehilite">ca.crt</code> that is enabled to authenticate against this Ingress.
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-tls-secret: secretName</span></code>:
The name of the Secret that contains the full Certificate Authority chain <code class="codehilite"><span class="err">ca.crt</span></code> that is enabled to authenticate against this Ingress.
This annotation also accepts the alternative form "namespace/secretName", in which case the Secret lookup is performed in the referenced namespace instead of the Ingress namespace.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-verify-depth</code>:
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-tls-verify-depth</span></code>:
The validation depth between the provided client certificate and the Certification Authority chain.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-verify-client</code>:
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-tls-verify-client</span></code>:
Enables verification of client certificates.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-error-page</code>:
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-tls-error-page</span></code>:
The URL/Page that user should be redirected in case of a Certificate Authentication Error</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream</code>:
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream</span></code>:
Indicates if the received certificates should be passed or not to the upstream server. By default this is disabled.</li>
</ul>
<div class="admonition example">
@ -2518,78 +2518,78 @@ This annotation also accepts the alternative form "namespace/secretName", in whi
<h3 id="backend-certificate-authentication">Backend Certificate Authentication<a class="headerlink" href="#backend-certificate-authentication" title="Permanent link"></a></h3>
<p>It is possible to authenticate to a proxied HTTPS backend with certificate using additional annotations in Ingress Rule.</p>
<ul>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-ssl-secret: secretName</code>:
Specifies a Secret with the certificate <code class="codehilite">tls.crt</code>, key <code class="codehilite">tls.key</code> in PEM format used for authentication to a proxied HTTPS server. It should also contain trusted CA certificates <code class="codehilite">ca.crt</code> in PEM format used to verify the certificate of the proxied HTTPS server.
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-ssl-secret: secretName</span></code>:
Specifies a Secret with the certificate <code class="codehilite"><span class="err">tls.crt</span></code>, key <code class="codehilite"><span class="err">tls.key</span></code> in PEM format used for authentication to a proxied HTTPS server. It should also contain trusted CA certificates <code class="codehilite"><span class="err">ca.crt</span></code> in PEM format used to verify the certificate of the proxied HTTPS server.
This annotation also accepts the alternative form "namespace/secretName", in which case the Secret lookup is performed in the referenced namespace instead of the Ingress namespace.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-ssl-verify</code>:
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-ssl-verify</span></code>:
Enables or disables verification of the proxied HTTPS server certificate. (default: off)</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-ssl-verify-depth</code>:
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-ssl-verify-depth</span></code>:
Sets the verification depth in the proxied HTTPS server certificates chain. (default: 1)</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-ssl-ciphers</code>:
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-ssl-ciphers</span></code>:
Specifies the enabled <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_ciphers">ciphers</a> for requests to a proxied HTTPS server. The ciphers are specified in the format understood by the OpenSSL library.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-ssl-protocols</code>:
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-ssl-protocols</span></code>:
Enables the specified <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_protocols">protocols</a> for requests to a proxied HTTPS server.</li>
</ul>
<h3 id="configuration-snippet">Configuration snippet<a class="headerlink" href="#configuration-snippet" title="Permanent link"></a></h3>
<p>Using this annotation you can add additional configuration to the NGINX location. For example:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/configuration-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/configuration-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<span class="no">more_set_headers &quot;Request-Id: $req_id&quot;;</span>
</pre></div>
</code></pre></div>
<h3 id="custom-http-errors">Custom HTTP Errors<a class="headerlink" href="#custom-http-errors" title="Permanent link"></a></h3>
<p>Like the <a href="../configmap/#custom-http-errors"><code class="codehilite">custom-http-errors</code></a> value in the ConfigMap, this annotation will set NGINX <code class="codehilite">proxy-intercept-errors</code>, but only for the NGINX location associated with this ingress. If a <a href="#default-backend">default backend annotation</a> is specified on the ingress, the errors will be routed to that annotation's default backend service (instead of the global default backend).
<p>Like the <a href="../configmap/#custom-http-errors"><code class="codehilite"><span class="err">custom-http-errors</span></code></a> value in the ConfigMap, this annotation will set NGINX <code class="codehilite"><span class="err">proxy-intercept-errors</span></code>, but only for the NGINX location associated with this ingress. If a <a href="#default-backend">default backend annotation</a> is specified on the ingress, the errors will be routed to that annotation's default backend service (instead of the global default backend).
Different ingresses can specify different sets of error codes. Even if multiple ingress objects share the same hostname, this annotation can be used to intercept different error codes for each ingress (for example, different error codes to be intercepted for different paths on the same hostname, if each path is on a different ingress).
If <code class="codehilite">custom-http-errors</code> is also specified globally, the error values specified in this annotation will override the global value for the given ingress' hostname and path.</p>
If <code class="codehilite"><span class="err">custom-http-errors</span></code> is also specified globally, the error values specified in this annotation will override the global value for the given ingress' hostname and path.</p>
<p>Example usage:
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/custom-http-errors: &quot;404,415&quot;
</pre></div></p>
<div class="codehilite"><pre><span></span><code><span class="err">nginx.ingress.kubernetes.io/custom-http-errors: &quot;404,415&quot;</span>
</code></pre></div></p>
<h3 id="default-backend">Default Backend<a class="headerlink" href="#default-backend" title="Permanent link"></a></h3>
<p>This annotation is of the form <code class="codehilite">nginx.ingress.kubernetes.io/default-backend: &lt;svc name&gt;</code> to specify a custom default backend. This <code class="codehilite">&lt;svc name&gt;</code> is a reference to a service inside of the same namespace in which you are applying this annotation. This annotation overrides the global default backend.</p>
<p>This annotation is of the form <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/default-backend: &lt;svc name&gt;</span></code> to specify a custom default backend. This <code class="codehilite"><span class="err">&lt;svc name&gt;</span></code> is a reference to a service inside of the same namespace in which you are applying this annotation. This annotation overrides the global default backend.</p>
<p>This service will be handle the response when the service in the Ingress rule does not have active endpoints. It will also handle the error responses if both this annotation and the <a href="#custom-http-errors">custom-http-errors annotation</a> is set.</p>
<h3 id="enable-cors">Enable CORS<a class="headerlink" href="#enable-cors" title="Permanent link"></a></h3>
<p>To enable Cross-Origin Resource Sharing (CORS) in an Ingress rule, add the annotation
<code class="codehilite">nginx.ingress.kubernetes.io/enable-cors: &quot;true&quot;</code>. This will add a section in the server
<code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/enable-cors: &quot;true&quot;</span></code>. This will add a section in the server
location enabling this functionality.</p>
<p>CORS can be controlled with the following annotations:</p>
<ul>
<li><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-methods</code>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-allow-methods</span></code>
controls which methods are accepted. This is a multi-valued field, separated by ',' and
accepts only letters (upper and lower case).</li>
<li>Default: <code class="codehilite">GET, PUT, POST, DELETE, PATCH, OPTIONS</code></li>
<li>Default: <code class="codehilite"><span class="err">GET, PUT, POST, DELETE, PATCH, OPTIONS</span></code></li>
<li>
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-methods: &quot;PUT, GET, POST, OPTIONS&quot;</code></p>
<p>Example: <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-allow-methods: &quot;PUT, GET, POST, OPTIONS&quot;</span></code></p>
</li>
<li>
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-headers</code>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-allow-headers</span></code>
controls which headers are accepted. This is a multi-valued field, separated by ',' and accepts letters,
numbers, _ and -.</p>
</li>
<li>Default: <code class="codehilite">DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization</code></li>
<li>Default: <code class="codehilite"><span class="err">DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization</span></code></li>
<li>
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-headers: &quot;X-Forwarded-For, X-app123-XPTO&quot;</code></p>
<p>Example: <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-allow-headers: &quot;X-Forwarded-For, X-app123-XPTO&quot;</span></code></p>
</li>
<li>
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-origin</code>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-allow-origin</span></code>
controls what's the accepted Origin for CORS.
This is a single field value, with the following format: <code class="codehilite">http(s)://origin-site.com</code> or <code class="codehilite">http(s)://origin-site.com:port</code></p>
This is a single field value, with the following format: <code class="codehilite"><span class="err">http(s)://origin-site.com</span></code> or <code class="codehilite"><span class="err">http(s)://origin-site.com:port</span></code></p>
</li>
<li>Default: <code class="codehilite">*</code></li>
<li>Default: <code class="codehilite"><span class="err">*</span></code></li>
<li>
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-origin: &quot;https://origin-site.com:4443&quot;</code></p>
<p>Example: <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-allow-origin: &quot;https://origin-site.com:4443&quot;</span></code></p>
</li>
<li>
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-credentials</code>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-allow-credentials</span></code>
controls if credentials can be passed during CORS operations.</p>
</li>
<li>Default: <code class="codehilite">true</code></li>
<li>Default: <code class="codehilite"><span class="err">true</span></code></li>
<li>
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-credentials: &quot;false&quot;</code></p>
<p>Example: <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-allow-credentials: &quot;false&quot;</span></code></p>
</li>
<li>
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-max-age</code>
<p><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-max-age</span></code>
controls how long preflight requests can be cached.
Default: <code class="codehilite">1728000</code>
Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-max-age: 600</code></p>
Default: <code class="codehilite"><span class="err">1728000</span></code>
Example: <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/cors-max-age: 600</span></code></p>
</li>
</ul>
<div class="admonition note">
@ -2601,22 +2601,22 @@ location enabling this functionality.</p>
<div class="admonition example">
<p class="admonition-title">Example</p>
<ul>
<li><code class="codehilite">nginx.ingress.kubernetes.io/http2-push-preload: &quot;true&quot;</code></li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/http2-push-preload: &quot;true&quot;</span></code></li>
</ul>
</div>
<h3 id="server-alias">Server Alias<a class="headerlink" href="#server-alias" title="Permanent link"></a></h3>
<p>Allows the definition of one or more aliases in the server definition of the NGINX configuration using the annotation <code class="codehilite">nginx.ingress.kubernetes.io/server-alias: &quot;&lt;alias 1&gt;,&lt;alias 2&gt;&quot;</code>.
This will create a server with the same configuration, but adding new values to the <code class="codehilite">server_name</code> directive.</p>
<p>Allows the definition of one or more aliases in the server definition of the NGINX configuration using the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/server-alias: &quot;&lt;alias 1&gt;,&lt;alias 2&gt;&quot;</span></code>.
This will create a server with the same configuration, but adding new values to the <code class="codehilite"><span class="err">server_name</span></code> directive.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A server-alias name cannot conflict with the hostname of an existing server. If it does, the server-alias annotation will be ignored.
If a server-alias is created and later a new server with the same hostname is created, the new server configuration will take
place over the alias configuration.</p>
</div>
<p>For more information please see <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name">the <code class="codehilite">server_name</code> documentation</a>.</p>
<p>For more information please see <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name">the <code class="codehilite"><span class="err">server_name</span></code> documentation</a>.</p>
<h3 id="server-snippet">Server snippet<a class="headerlink" href="#server-snippet" title="Permanent link"></a></h3>
<p>Using the annotation <code class="codehilite">nginx.ingress.kubernetes.io/server-snippet</code> it is possible to add custom configuration in the server configuration block.</p>
<div class="codehilite"><pre><span></span><span class="nt">apiVersion</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">networking.k8s.io/v1beta1</span>
<p>Using the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/server-snippet</span></code> it is possible to add custom configuration in the server configuration block.</p>
<div class="codehilite"><pre><span></span><code><span class="nt">apiVersion</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">networking.k8s.io/v1beta1</span>
<span class="nt">kind</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">Ingress</span>
<span class="nt">metadata</span><span class="p">:</span>
<span class="nt">annotations</span><span class="p">:</span>
@ -2630,7 +2630,7 @@ place over the alias configuration.</p>
<span class="no">if ( $agentflag = 1 ) {</span>
<span class="no">return 301 https://m.example.com;</span>
<span class="no">}</span>
</pre></div>
</code></pre></div>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
@ -2648,82 +2648,85 @@ applied to each location provided in the ingress rule.</p>
<div class="admonition example">
<p class="admonition-title">Example</p>
<ul>
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: &quot;1000&quot;</code> # 1000 bytes</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: 1k</code> # 1 kilobyte</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: 1K</code> # 1 kilobyte</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: 1m</code> # 1 megabyte</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: 1M</code> # 1 megabyte</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/client-body-buffer-size: &quot;1000&quot;</span></code> # 1000 bytes</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/client-body-buffer-size: 1k</span></code> # 1 kilobyte</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/client-body-buffer-size: 1K</span></code> # 1 kilobyte</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/client-body-buffer-size: 1m</span></code> # 1 megabyte</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/client-body-buffer-size: 1M</span></code> # 1 megabyte</li>
</ul>
</div>
<p>For more information please see <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size">http://nginx.org</a></p>
<h3 id="external-authentication">External Authentication<a class="headerlink" href="#external-authentication" title="Permanent link"></a></h3>
<p>To use an existing service that provides authentication the Ingress rule can be annotated with <code class="codehilite">nginx.ingress.kubernetes.io/auth-url</code> to indicate the URL where the HTTP request should be sent.</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/auth-url</span><span class="p">:</span> <span class="s">&quot;URL</span><span class="nv"> </span><span class="s">to</span><span class="nv"> </span><span class="s">the</span><span class="nv"> </span><span class="s">authentication</span><span class="nv"> </span><span class="s">service&quot;</span>
</pre></div>
<p>To use an existing service that provides authentication the Ingress rule can be annotated with <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-url</span></code> to indicate the URL where the HTTP request should be sent.</p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/auth-url</span><span class="p">:</span> <span class="s">&quot;URL</span><span class="nv"> </span><span class="s">to</span><span class="nv"> </span><span class="s">the</span><span class="nv"> </span><span class="s">authentication</span><span class="nv"> </span><span class="s">service&quot;</span>
</code></pre></div>
<p>Additionally it is possible to set:</p>
<ul>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-method</code>:
<code class="codehilite">&lt;Method&gt;</code> to specify the HTTP method to use.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-signin</code>:
<code class="codehilite">&lt;SignIn_URL&gt;</code> to specify the location of the error page.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-response-headers</code>:
<code class="codehilite">&lt;Response_Header_1, ..., Response_Header_n&gt;</code> to specify headers to pass to backend once authentication request completes.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-proxy-set-headers</code>:
<code class="codehilite">&lt;ConfigMap&gt;</code> the name of a ConfigMap that specifies headers to pass to the authentication service</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-request-redirect</code>:
<code class="codehilite">&lt;Request_Redirect_URL&gt;</code> to specify the X-Auth-Request-Redirect header value.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-cache-key</code>:
<code class="codehilite">&lt;Cache_Key&gt;</code> this enables caching for auth requests. specify a lookup key for auth responses. e.g. <code class="codehilite">$remote_user$http_authorization</code>. Each server and location has it's own keyspace. Hence a cached response is only valid on a per-server and per-location basis.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-cache-duration</code>:
<code class="codehilite">&lt;Cache_duration&gt;</code> to specify a caching time for auth responses based on their response codes, e.g. <code class="codehilite">200 202 30m</code>. See <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid">proxy_cache_valid</a> for details. You may specify multiple, comma-separated values: <code class="codehilite">200 202 10m, 401 5m</code>. defaults to <code class="codehilite">200 202 401 5m</code>.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-snippet</code>:
<code class="codehilite">&lt;Auth_Snippet&gt;</code> to specify a custom snippet to use with external authentication, e.g.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-method</span></code>:
<code class="codehilite"><span class="err">&lt;Method&gt;</span></code> to specify the HTTP method to use.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-signin</span></code>:
<code class="codehilite"><span class="err">&lt;SignIn_URL&gt;</span></code> to specify the location of the error page.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-response-headers</span></code>:
<code class="codehilite"><span class="err">&lt;Response_Header_1, ..., Response_Header_n&gt;</span></code> to specify headers to pass to backend once authentication request completes.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-proxy-set-headers</span></code>:
<code class="codehilite"><span class="err">&lt;ConfigMap&gt;</span></code> the name of a ConfigMap that specifies headers to pass to the authentication service</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-request-redirect</span></code>:
<code class="codehilite"><span class="err">&lt;Request_Redirect_URL&gt;</span></code> to specify the X-Auth-Request-Redirect header value.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-cache-key</span></code>:
<code class="codehilite"><span class="err">&lt;Cache_Key&gt;</span></code> this enables caching for auth requests. specify a lookup key for auth responses. e.g. <code class="codehilite"><span class="err">$remote_user$http_authorization</span></code>. Each server and location has it's own keyspace. Hence a cached response is only valid on a per-server and per-location basis.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-cache-duration</span></code>:
<code class="codehilite"><span class="err">&lt;Cache_duration&gt;</span></code> to specify a caching time for auth responses based on their response codes, e.g. <code class="codehilite"><span class="err">200 202 30m</span></code>. See <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid">proxy_cache_valid</a> for details. You may specify multiple, comma-separated values: <code class="codehilite"><span class="err">200 202 10m, 401 5m</span></code>. defaults to <code class="codehilite"><span class="err">200 202 401 5m</span></code>.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-snippet</span></code>:
<code class="codehilite"><span class="err">&lt;Auth_Snippet&gt;</span></code> to specify a custom snippet to use with external authentication, e.g.</li>
</ul>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/auth-url</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">http://foo.com/external-auth</span>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/auth-url</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">http://foo.com/external-auth</span>
<span class="nt">nginx.ingress.kubernetes.io/auth-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<span class="no">proxy_set_header Foo-Header 42;</span>
</pre></div>
</code></pre></div>
<blockquote>
<p>Note: <code class="codehilite">nginx.ingress.kubernetes.io/auth-snippet</code> is an optional annotation. However, it may only be used in conjunction with <code class="codehilite">nginx.ingress.kubernetes.io/auth-url</code> and will be ignored if <code class="codehilite">nginx.ingress.kubernetes.io/auth-url</code> is not set</p>
<p>Note: <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-snippet</span></code> is an optional annotation. However, it may only be used in conjunction with <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-url</span></code> and will be ignored if <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/auth-url</span></code> is not set</p>
</blockquote>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p>Please check the <a href="../../../examples/auth/external-auth/">external-auth</a> example.</p>
</div>
<h4 id="global-external-authentication">Global External Authentication<a class="headerlink" href="#global-external-authentication" title="Permanent link"></a></h4>
<p>By default the controller redirects all requests to an existing service that provides authentication if <code class="codehilite">global-auth-url</code> is set in the NGINX ConfigMap. If you want to disable this behavior for that ingress, you can use <code class="codehilite">enable-global-auth: &quot;false&quot;</code> in the NGINX ConfigMap.
<code class="codehilite">nginx.ingress.kubernetes.io/enable-global-auth</code>:
indicates if GlobalExternalAuth configuration should be applied or not to this Ingress rule. Default values is set to <code class="codehilite">&quot;true&quot;</code>.</p>
<p>!!! note For more information please see <a href="../configmap/#global-auth-url">global-auth-url</a>.</p>
<p>By default the controller redirects all requests to an existing service that provides authentication if <code class="codehilite"><span class="err">global-auth-url</span></code> is set in the NGINX ConfigMap. If you want to disable this behavior for that ingress, you can use <code class="codehilite"><span class="c">enable-global-auth: &quot;false&quot;</span></code> in the NGINX ConfigMap.
<code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/enable-global-auth</span></code>:
indicates if GlobalExternalAuth configuration should be applied or not to this Ingress rule. Default values is set to <code class="codehilite"><span class="err">&quot;true&quot;</span></code>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>For more information please see <a href="../configmap/#global-auth-url">global-auth-url</a>.</p>
</div>
<h3 id="rate-limiting">Rate limiting<a class="headerlink" href="#rate-limiting" title="Permanent link"></a></h3>
<p>These annotations define limits on connections and transmission rates. These can be used to mitigate <a href="https://www.nginx.com/blog/mitigating-ddos-attacks-with-nginx-and-nginx-plus">DDoS Attacks</a>.</p>
<ul>
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-connections</code>: number of concurrent connections allowed from a single IP address. A 503 error is returned when exceeding this limit.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-rps</code>: number of requests accepted from a given IP each second. The burst limit is set to 5 times the limit. When clients exceed this limit, <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#limit-req-status-code">limit-req-status-code</a> <strong><em>default:</em></strong> 503 is returned.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-rpm</code>: number of requests accepted from a given IP each minute. The burst limit is set to 5 times the limit. When clients exceed this limit, <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#limit-req-status-code">limit-req-status-code</a> <strong><em>default:</em></strong> 503 is returned.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-rate-after</code>: initial number of kilobytes after which the further transmission of a response to a given connection will be rate limited. This feature must be used with <a href="#proxy-buffering">proxy-buffering</a> enabled.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-rate</code>: number of kilobytes per second allowed to send to a given connection. The zero value disables rate limiting. This feature must be used with <a href="#proxy-buffering">proxy-buffering</a> enabled.</li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-whitelist</code>: client IP source ranges to be excluded from rate-limiting. The value is a comma separated list of CIDRs.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/limit-connections</span></code>: number of concurrent connections allowed from a single IP address. A 503 error is returned when exceeding this limit.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/limit-rps</span></code>: number of requests accepted from a given IP each second. The burst limit is set to 5 times the limit. When clients exceed this limit, <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#limit-req-status-code">limit-req-status-code</a> <strong><em>default:</em></strong> 503 is returned.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/limit-rpm</span></code>: number of requests accepted from a given IP each minute. The burst limit is set to 5 times the limit. When clients exceed this limit, <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#limit-req-status-code">limit-req-status-code</a> <strong><em>default:</em></strong> 503 is returned.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/limit-rate-after</span></code>: initial number of kilobytes after which the further transmission of a response to a given connection will be rate limited. This feature must be used with <a href="#proxy-buffering">proxy-buffering</a> enabled.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/limit-rate</span></code>: number of kilobytes per second allowed to send to a given connection. The zero value disables rate limiting. This feature must be used with <a href="#proxy-buffering">proxy-buffering</a> enabled.</li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/limit-whitelist</span></code>: client IP source ranges to be excluded from rate-limiting. The value is a comma separated list of CIDRs.</li>
</ul>
<p>If you specify multiple annotations in a single Ingress rule, limits are applied in the order <code class="codehilite">limit-connections</code>, <code class="codehilite">limit-rpm</code>, <code class="codehilite">limit-rps</code>.</p>
<p>To configure settings globally for all Ingress rules, the <code class="codehilite">limit-rate-after</code> and <code class="codehilite">limit-rate</code> values may be set in the <a href="../configmap/#limit-rate">NGINX ConfigMap</a>. The value set in an Ingress annotation will override the global setting.</p>
<p>The client IP address will be set based on the use of <a href="../configmap/#use-proxy-protocol">PROXY protocol</a> or from the <code class="codehilite">X-Forwarded-For</code> header value when <a href="../configmap/#use-forwarded-headers">use-forwarded-headers</a> is enabled.</p>
<p>If you specify multiple annotations in a single Ingress rule, limits are applied in the order <code class="codehilite"><span class="err">limit-connections</span></code>, <code class="codehilite"><span class="err">limit-rpm</span></code>, <code class="codehilite"><span class="err">limit-rps</span></code>.</p>
<p>To configure settings globally for all Ingress rules, the <code class="codehilite"><span class="err">limit-rate-after</span></code> and <code class="codehilite"><span class="err">limit-rate</span></code> values may be set in the <a href="../configmap/#limit-rate">NGINX ConfigMap</a>. The value set in an Ingress annotation will override the global setting.</p>
<p>The client IP address will be set based on the use of <a href="../configmap/#use-proxy-protocol">PROXY protocol</a> or from the <code class="codehilite"><span class="err">X-Forwarded-For</span></code> header value when <a href="../configmap/#use-forwarded-headers">use-forwarded-headers</a> is enabled.</p>
<h3 id="permanent-redirect">Permanent Redirect<a class="headerlink" href="#permanent-redirect" title="Permanent link"></a></h3>
<p>This annotation allows to return a permanent redirect instead of sending data to the upstream. For example <code class="codehilite">nginx.ingress.kubernetes.io/permanent-redirect: https://www.google.com</code> would redirect everything to Google.</p>
<p>This annotation allows to return a permanent redirect instead of sending data to the upstream. For example <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/permanent-redirect: https://www.google.com</span></code> would redirect everything to Google.</p>
<h3 id="permanent-redirect-code">Permanent Redirect Code<a class="headerlink" href="#permanent-redirect-code" title="Permanent link"></a></h3>
<p>This annotation allows you to modify the status code used for permanent redirects. For example <code class="codehilite">nginx.ingress.kubernetes.io/permanent-redirect-code: &#39;308&#39;</code> would return your permanent-redirect with a 308.</p>
<p>This annotation allows you to modify the status code used for permanent redirects. For example <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/permanent-redirect-code: &#39;308&#39;</span></code> would return your permanent-redirect with a 308.</p>
<h3 id="temporal-redirect">Temporal Redirect<a class="headerlink" href="#temporal-redirect" title="Permanent link"></a></h3>
<p>This annotation allows you to return a temporal redirect (Return Code 302) instead of sending data to the upstream. For example <code class="codehilite">nginx.ingress.kubernetes.io/temporal-redirect: https://www.google.com</code> would redirect everything to Google with a Return Code of 302 (Moved Temporarily)</p>
<p>This annotation allows you to return a temporal redirect (Return Code 302) instead of sending data to the upstream. For example <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/temporal-redirect: https://www.google.com</span></code> would redirect everything to Google with a Return Code of 302 (Moved Temporarily)</p>
<h3 id="ssl-passthrough">SSL Passthrough<a class="headerlink" href="#ssl-passthrough" title="Permanent link"></a></h3>
<p>The annotation <code class="codehilite">nginx.ingress.kubernetes.io/ssl-passthrough</code> instructs the controller to send TLS connections directly
<p>The annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/ssl-passthrough</span></code> instructs the controller to send TLS connections directly
to the backend instead of letting NGINX decrypt the communication. See also <a href="../../tls/#ssl-passthrough">TLS/HTTPS</a> in
the User guide.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>SSL Passthrough is <strong>disabled by default</strong> and requires starting the controller with the
<a href="../../cli-arguments/"><code class="codehilite">--enable-ssl-passthrough</code></a> flag.</p>
<a href="../../cli-arguments/"><code class="codehilite"><span class="err">--enable-ssl-passthrough</span></code></a> flag.</p>
</div>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
@ -2732,37 +2735,37 @@ invalidates all the other annotations set on an Ingress object.</p>
</div>
<h3 id="service-upstream">Service Upstream<a class="headerlink" href="#service-upstream" title="Permanent link"></a></h3>
<p>By default the NGINX ingress controller uses a list of all endpoints (Pod IP/port) in the NGINX upstream configuration.</p>
<p>The <code class="codehilite">nginx.ingress.kubernetes.io/service-upstream</code> annotation disables that behavior and instead uses a single upstream in NGINX, the service's Cluster IP and port.</p>
<p>The <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/service-upstream</span></code> annotation disables that behavior and instead uses a single upstream in NGINX, the service's Cluster IP and port.</p>
<p>This can be desirable for things like zero-downtime deployments as it reduces the need to reload NGINX configuration when Pods come up and down. See issue <a href="https://github.com/kubernetes/ingress-nginx/issues/257">#257</a>.</p>
<h4 id="known-issues">Known Issues<a class="headerlink" href="#known-issues" title="Permanent link"></a></h4>
<p>If the <code class="codehilite">service-upstream</code> annotation is specified the following things should be taken into consideration:</p>
<p>If the <code class="codehilite"><span class="err">service-upstream</span></code> annotation is specified the following things should be taken into consideration:</p>
<ul>
<li>Sticky Sessions will not work as only round-robin load balancing is supported.</li>
<li>The <code class="codehilite">proxy_next_upstream</code> directive will not have any effect meaning on error the request will not be dispatched to another upstream.</li>
<li>The <code class="codehilite"><span class="err">proxy_next_upstream</span></code> directive will not have any effect meaning on error the request will not be dispatched to another upstream.</li>
</ul>
<h3 id="server-side-https-enforcement-through-redirect">Server-side HTTPS enforcement through redirect<a class="headerlink" href="#server-side-https-enforcement-through-redirect" title="Permanent link"></a></h3>
<p>By default the controller redirects (308) to HTTPS if TLS is enabled for that ingress.
If you want to disable this behavior globally, you can use <code class="codehilite">ssl-redirect: &quot;false&quot;</code> in the NGINX <a href="../configmap/#ssl-redirect">ConfigMap</a>.</p>
<p>To configure this feature for specific ingress resources, you can use the <code class="codehilite">nginx.ingress.kubernetes.io/ssl-redirect: &quot;false&quot;</code>
If you want to disable this behavior globally, you can use <code class="codehilite"><span class="c">ssl-redirect: &quot;false&quot;</span></code> in the NGINX <a href="../configmap/#ssl-redirect">ConfigMap</a>.</p>
<p>To configure this feature for specific ingress resources, you can use the <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/ssl-redirect: &quot;false&quot;</span></code>
annotation in the particular resource.</p>
<p>When using SSL offloading outside of cluster (e.g. AWS ELB) it may be useful to enforce a redirect to HTTPS
even when there is no TLS certificate available.
This can be achieved by using the <code class="codehilite">nginx.ingress.kubernetes.io/force-ssl-redirect: &quot;true&quot;</code> annotation in the particular resource.</p>
This can be achieved by using the <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/force-ssl-redirect: &quot;true&quot;</span></code> annotation in the particular resource.</p>
<h3 id="redirect-fromto-www">Redirect from/to www<a class="headerlink" href="#redirect-fromto-www" title="Permanent link"></a></h3>
<p>In some scenarios is required to redirect from <code class="codehilite">www.domain.com</code> to <code class="codehilite">domain.com</code> or vice versa.
To enable this feature use the annotation <code class="codehilite">nginx.ingress.kubernetes.io/from-to-www-redirect: &quot;true&quot;</code></p>
<p>In some scenarios is required to redirect from <code class="codehilite"><span class="err">www.domain.com</span></code> to <code class="codehilite"><span class="err">domain.com</span></code> or vice versa.
To enable this feature use the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/from-to-www-redirect: &quot;true&quot;</span></code></p>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>If at some point a new Ingress is created with a host equal to one of the options (like <code class="codehilite">domain.com</code>) the annotation will be omitted.</p>
<p>If at some point a new Ingress is created with a host equal to one of the options (like <code class="codehilite"><span class="err">domain.com</span></code>) the annotation will be omitted.</p>
</div>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>For HTTPS to HTTPS redirects is mandatory the SSL Certificate defined in the Secret, located in the TLS section of Ingress, contains both FQDN in the common name of the certificate.</p>
</div>
<h3 id="whitelist-source-range">Whitelist source range<a class="headerlink" href="#whitelist-source-range" title="Permanent link"></a></h3>
<p>You can specify allowed client IP source ranges through the <code class="codehilite">nginx.ingress.kubernetes.io/whitelist-source-range</code> annotation.
The value is a comma separated list of <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDRs</a>, e.g. <code class="codehilite">10.0.0.0/24,172.10.0.1</code>.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">whitelist-source-range</code> value may be set in the <a href="../configmap/#whitelist-source-range">NGINX ConfigMap</a>.</p>
<p>You can specify allowed client IP source ranges through the <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/whitelist-source-range</span></code> annotation.
The value is a comma separated list of <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDRs</a>, e.g. <code class="codehilite"><span class="err">10.0.0.0/24,172.10.0.1</span></code>.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite"><span class="err">whitelist-source-range</span></code> value may be set in the <a href="../configmap/#whitelist-source-range">NGINX ConfigMap</a>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Adding an annotation to an Ingress rule overrides any global restriction.</p>
@ -2771,135 +2774,135 @@ The value is a comma separated list of <a href="https://en.wikipedia.org/wiki/Cl
<p>Using the configuration configmap it is possible to set the default global timeout for connections to the upstream servers.
In some scenarios is required to have different values. To allow this we provide annotations that allows this customization:</p>
<ul>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-connect-timeout</code></li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-send-timeout</code></li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-read-timeout</code></li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-next-upstream</code></li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-next-upstream-timeout</code></li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-next-upstream-tries</code></li>
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-request-buffering</code></li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-connect-timeout</span></code></li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-send-timeout</span></code></li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-read-timeout</span></code></li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-next-upstream</span></code></li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-next-upstream-timeout</span></code></li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-next-upstream-tries</span></code></li>
<li><code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-request-buffering</span></code></li>
</ul>
<h3 id="proxy-redirect">Proxy redirect<a class="headerlink" href="#proxy-redirect" title="Permanent link"></a></h3>
<p>With the annotations <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-from</code> and <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-to</code> it is possible to
set the text that should be changed in the <code class="codehilite">Location</code> and <code class="codehilite">Refresh</code> header fields of a <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect">proxied server response</a></p>
<p>Setting "off" or "default" in the annotation <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-from</code> disables <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-to</code>,
<p>With the annotations <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-redirect-from</span></code> and <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-redirect-to</span></code> it is possible to
set the text that should be changed in the <code class="codehilite"><span class="err">Location</span></code> and <code class="codehilite"><span class="err">Refresh</span></code> header fields of a <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect">proxied server response</a></p>
<p>Setting "off" or "default" in the annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-redirect-from</span></code> disables <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/proxy-redirect-to</span></code>,
otherwise, both annotations must be used in unison. Note that each annotation must be a string without spaces.</p>
<p>By default the value of each annotation is "off".</p>
<h3 id="custom-max-body-size">Custom max body size<a class="headerlink" href="#custom-max-body-size" title="Permanent link"></a></h3>
<p>For NGINX, an 413 error will be returned to the client when the size in a request exceeds the maximum allowed size of the client request body. This size can be configured by the parameter <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size"><code class="codehilite">client_max_body_size</code></a>.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">proxy-body-size</code> value may be set in the <a href="../configmap/#proxy-body-size">NGINX ConfigMap</a>.
<p>For NGINX, an 413 error will be returned to the client when the size in a request exceeds the maximum allowed size of the client request body. This size can be configured by the parameter <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size"><code class="codehilite"><span class="err">client_max_body_size</span></code></a>.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite"><span class="err">proxy-body-size</span></code> value may be set in the <a href="../configmap/#proxy-body-size">NGINX ConfigMap</a>.
To use custom values in an Ingress rule define these annotation:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/proxy-body-size</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">8m</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/proxy-body-size</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">8m</span>
</code></pre></div>
<h3 id="proxy-cookie-domain">Proxy cookie domain<a class="headerlink" href="#proxy-cookie-domain" title="Permanent link"></a></h3>
<p>Sets a text that <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cookie_domain">should be changed in the domain attribute</a> of the "Set-Cookie" header fields of a proxied server response.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">proxy-cookie-domain</code> value may be set in the <a href="../configmap/#proxy-cookie-domain">NGINX ConfigMap</a>.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite"><span class="err">proxy-cookie-domain</span></code> value may be set in the <a href="../configmap/#proxy-cookie-domain">NGINX ConfigMap</a>.</p>
<h3 id="proxy-cookie-path">Proxy cookie path<a class="headerlink" href="#proxy-cookie-path" title="Permanent link"></a></h3>
<p>Sets a text that <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cookie_path">should be changed in the path attribute</a> of the "Set-Cookie" header fields of a proxied server response.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">proxy-cookie-path</code> value may be set in the <a href="../configmap/#proxy-cookie-path">NGINX ConfigMap</a>.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite"><span class="err">proxy-cookie-path</span></code> value may be set in the <a href="../configmap/#proxy-cookie-path">NGINX ConfigMap</a>.</p>
<h3 id="proxy-buffering">Proxy buffering<a class="headerlink" href="#proxy-buffering" title="Permanent link"></a></h3>
<p>Enable or disable proxy buffering <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering"><code class="codehilite">proxy_buffering</code></a>.
<p>Enable or disable proxy buffering <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering"><code class="codehilite"><span class="err">proxy_buffering</span></code></a>.
By default proxy buffering is disabled in the NGINX config.</p>
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">proxy-buffering</code> value may be set in the <a href="../configmap/#proxy-buffering">NGINX ConfigMap</a>.
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite"><span class="err">proxy-buffering</span></code> value may be set in the <a href="../configmap/#proxy-buffering">NGINX ConfigMap</a>.
To use custom values in an Ingress rule define these annotation:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/proxy-buffering</span><span class="p">:</span> <span class="s">&quot;on&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/proxy-buffering</span><span class="p">:</span> <span class="s">&quot;on&quot;</span>
</code></pre></div>
<h3 id="proxy-buffers-number">Proxy buffers Number<a class="headerlink" href="#proxy-buffers-number" title="Permanent link"></a></h3>
<p>Sets the number of the buffers in <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers"><code class="codehilite">proxy_buffers</code></a> used for reading the first part of the response received from the proxied server.
<p>Sets the number of the buffers in <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers"><code class="codehilite"><span class="err">proxy_buffers</span></code></a> used for reading the first part of the response received from the proxied server.
By default proxy buffers number is set as 4</p>
<p>To configure this setting globally, set <code class="codehilite">proxy-buffers-number</code> in <a href="../configmap/#proxy-buffers-number">NGINX ConfigMap</a>. To use custom values in an Ingress rule, define this annotation:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/proxy-buffers-number</span><span class="p">:</span> <span class="s">&quot;4&quot;</span>
</pre></div></p>
<p>To configure this setting globally, set <code class="codehilite"><span class="err">proxy-buffers-number</span></code> in <a href="../configmap/#proxy-buffers-number">NGINX ConfigMap</a>. To use custom values in an Ingress rule, define this annotation:
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/proxy-buffers-number</span><span class="p">:</span> <span class="s">&quot;4&quot;</span>
</code></pre></div></p>
<h3 id="proxy-buffer-size">Proxy buffer size<a class="headerlink" href="#proxy-buffer-size" title="Permanent link"></a></h3>
<p>Sets the size of the buffer <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size"><code class="codehilite">proxy_buffer_size</code></a> used for reading the first part of the response received from the proxied server.
<p>Sets the size of the buffer <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size"><code class="codehilite"><span class="err">proxy_buffer_size</span></code></a> used for reading the first part of the response received from the proxied server.
By default proxy buffer size is set as "4k"</p>
<p>To configure this setting globally, set <code class="codehilite">proxy-buffer-size</code> in <a href="../configmap/#proxy-buffer-size">NGINX ConfigMap</a>. To use custom values in an Ingress rule, define this annotation:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/proxy-buffer-size</span><span class="p">:</span> <span class="s">&quot;8k&quot;</span>
</pre></div></p>
<p>To configure this setting globally, set <code class="codehilite"><span class="err">proxy-buffer-size</span></code> in <a href="../configmap/#proxy-buffer-size">NGINX ConfigMap</a>. To use custom values in an Ingress rule, define this annotation:
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/proxy-buffer-size</span><span class="p">:</span> <span class="s">&quot;8k&quot;</span>
</code></pre></div></p>
<h3 id="proxy-max-temp-file-size">Proxy max temp file size<a class="headerlink" href="#proxy-max-temp-file-size" title="Permanent link"></a></h3>
<p>When <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering"><code class="codehilite">buffering</code></a> of responses from the proxied server is enabled, and the whole response does not fit into the buffers set by the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size"><code class="codehilite">proxy_buffer_size</code></a> and <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers"><code class="codehilite">proxy_buffers</code></a> directives, a part of the response can be saved to a temporary file. This directive sets the maximum <code class="codehilite">size</code> of the temporary file setting the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_max_temp_file_size"><code class="codehilite">proxy_max_temp_file_size</code></a>. The size of data written to the temporary file at a time is set by the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_temp_file_write_size"><code class="codehilite">proxy_temp_file_write_size</code></a> directive.</p>
<p>When <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering"><code class="codehilite"><span class="err">buffering</span></code></a> of responses from the proxied server is enabled, and the whole response does not fit into the buffers set by the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size"><code class="codehilite"><span class="err">proxy_buffer_size</span></code></a> and <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers"><code class="codehilite"><span class="err">proxy_buffers</span></code></a> directives, a part of the response can be saved to a temporary file. This directive sets the maximum <code class="codehilite"><span class="err">size</span></code> of the temporary file setting the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_max_temp_file_size"><code class="codehilite"><span class="err">proxy_max_temp_file_size</span></code></a>. The size of data written to the temporary file at a time is set by the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_temp_file_write_size"><code class="codehilite"><span class="err">proxy_temp_file_write_size</span></code></a> directive.</p>
<p>The zero value disables buffering of responses to temporary files.</p>
<p>To use custom values in an Ingress rule, define this annotation:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/proxy-max-temp-file-size</span><span class="p">:</span> <span class="s">&quot;1024m&quot;</span>
</pre></div></p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/proxy-max-temp-file-size</span><span class="p">:</span> <span class="s">&quot;1024m&quot;</span>
</code></pre></div></p>
<h3 id="proxy-http-version">Proxy HTTP version<a class="headerlink" href="#proxy-http-version" title="Permanent link"></a></h3>
<p>Using this annotation sets the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version"><code class="codehilite">proxy_http_version</code></a> that the Nginx reverse proxy will use to communicate with the backend.
<p>Using this annotation sets the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version"><code class="codehilite"><span class="err">proxy_http_version</span></code></a> that the Nginx reverse proxy will use to communicate with the backend.
By default this is set to "1.1".</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/proxy-http-version</span><span class="p">:</span> <span class="s">&quot;1.0&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/proxy-http-version</span><span class="p">:</span> <span class="s">&quot;1.0&quot;</span>
</code></pre></div>
<h3 id="ssl-ciphers">SSL ciphers<a class="headerlink" href="#ssl-ciphers" title="Permanent link"></a></h3>
<p>Specifies the <a href="http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ciphers">enabled ciphers</a>.</p>
<p>Using this annotation will set the <code class="codehilite">ssl_ciphers</code> directive at the server level. This configuration is active for all the paths in the host.</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/ssl-ciphers</span><span class="p">:</span> <span class="s">&quot;ALL:!aNULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP&quot;</span>
</pre></div>
<p>Using this annotation will set the <code class="codehilite"><span class="err">ssl_ciphers</span></code> directive at the server level. This configuration is active for all the paths in the host.</p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/ssl-ciphers</span><span class="p">:</span> <span class="s">&quot;ALL:!aNULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP&quot;</span>
</code></pre></div>
<h3 id="connection-proxy-header">Connection proxy header<a class="headerlink" href="#connection-proxy-header" title="Permanent link"></a></h3>
<p>Using this annotation will override the default connection header set by NGINX.
To use custom values in an Ingress rule, define the annotation:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/connection-proxy-header</span><span class="p">:</span> <span class="s">&quot;keep-alive&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/connection-proxy-header</span><span class="p">:</span> <span class="s">&quot;keep-alive&quot;</span>
</code></pre></div>
<h3 id="enable-access-log">Enable Access Log<a class="headerlink" href="#enable-access-log" title="Permanent link"></a></h3>
<p>Access logs are enabled by default, but in some scenarios access logs might be required to be disabled for a given
ingress. To do this, use the annotation:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/enable-access-log</span><span class="p">:</span> <span class="s">&quot;false&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/enable-access-log</span><span class="p">:</span> <span class="s">&quot;false&quot;</span>
</code></pre></div>
<h3 id="enable-rewrite-log">Enable Rewrite Log<a class="headerlink" href="#enable-rewrite-log" title="Permanent link"></a></h3>
<p>Rewrite logs are not enabled by default. In some scenarios it could be required to enable NGINX rewrite logs.
Note that rewrite logs are sent to the error_log file at the notice level. To enable this feature use the annotation:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/enable-rewrite-log</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/enable-rewrite-log</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</code></pre></div>
<h3 id="enable-opentracing">Enable Opentracing<a class="headerlink" href="#enable-opentracing" title="Permanent link"></a></h3>
<p>Opentracing can be enabled or disabled globally through the ConfigMap but this will sometimes need to be overridden
to enable it or disable it for a specific ingress (e.g. to turn off tracing of external health check endpoints)</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/enable-opentracing</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/enable-opentracing</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</code></pre></div>
<h3 id="x-forwarded-prefix-header">X-Forwarded-Prefix Header<a class="headerlink" href="#x-forwarded-prefix-header" title="Permanent link"></a></h3>
<p>To add the non-standard <code class="codehilite">X-Forwarded-Prefix</code> header to the upstream request with a string value, the following annotation can be used:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/x-forwarded-prefix</span><span class="p">:</span> <span class="s">&quot;/path&quot;</span>
</pre></div>
<p>To add the non-standard <code class="codehilite"><span class="err">X-Forwarded-Prefix</span></code> header to the upstream request with a string value, the following annotation can be used:</p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/x-forwarded-prefix</span><span class="p">:</span> <span class="s">&quot;/path&quot;</span>
</code></pre></div>
<h3 id="lua-resty-waf">Lua Resty WAF<a class="headerlink" href="#lua-resty-waf" title="Permanent link"></a></h3>
<p>Using <code class="codehilite">lua-resty-waf-*</code> annotations we can enable and control the <a href="https://github.com/p0pr0ck5/lua-resty-waf">lua-resty-waf</a>
<p>Using <code class="codehilite"><span class="err">lua-resty-waf-*</span></code> annotations we can enable and control the <a href="https://github.com/p0pr0ck5/lua-resty-waf">lua-resty-waf</a>
Web Application Firewall per location.</p>
<p>Following configuration will enable the WAF for the paths defined in the corresponding ingress:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf</span><span class="p">:</span> <span class="s">&quot;active&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf</span><span class="p">:</span> <span class="s">&quot;active&quot;</span>
</code></pre></div>
<p>In order to run it in debugging mode you can set <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf-debug</code> to <code class="codehilite">&quot;true&quot;</code> in addition to the above configuration.
The other possible values for <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf</code> are <code class="codehilite">inactive</code> and <code class="codehilite">simulate</code>.
In <code class="codehilite">inactive</code> mode WAF won't do anything, whereas in <code class="codehilite">simulate</code> mode it will log a warning message if there's a matching WAF rule for given request. This is useful to debug a rule and eliminate possible false positives before fully deploying it.</p>
<p><code class="codehilite">lua-resty-waf</code> comes with predefined set of rules <a href="https://github.com/p0pr0ck5/lua-resty-waf/tree/84b4f40362500dd0cb98b9e71b5875cb1a40f1ad/rules">https://github.com/p0pr0ck5/lua-resty-waf/tree/84b4f40362500dd0cb98b9e71b5875cb1a40f1ad/rules</a> that covers ModSecurity CRS.
You can use <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets</code> to ignore a subset of those rulesets. For an example:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets</span><span class="p">:</span> <span class="s">&quot;41000_sqli,</span><span class="nv"> </span><span class="s">42000_xss&quot;</span>
</pre></div>
<p>In order to run it in debugging mode you can set <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/lua-resty-waf-debug</span></code> to <code class="codehilite"><span class="err">&quot;true&quot;</span></code> in addition to the above configuration.
The other possible values for <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/lua-resty-waf</span></code> are <code class="codehilite"><span class="err">inactive</span></code> and <code class="codehilite"><span class="err">simulate</span></code>.
In <code class="codehilite"><span class="err">inactive</span></code> mode WAF won't do anything, whereas in <code class="codehilite"><span class="err">simulate</span></code> mode it will log a warning message if there's a matching WAF rule for given request. This is useful to debug a rule and eliminate possible false positives before fully deploying it.</p>
<p><code class="codehilite"><span class="err">lua-resty-waf</span></code> comes with predefined set of rules <a href="https://github.com/p0pr0ck5/lua-resty-waf/tree/84b4f40362500dd0cb98b9e71b5875cb1a40f1ad/rules">https://github.com/p0pr0ck5/lua-resty-waf/tree/84b4f40362500dd0cb98b9e71b5875cb1a40f1ad/rules</a> that covers ModSecurity CRS.
You can use <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets</span></code> to ignore a subset of those rulesets. For an example:</p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets</span><span class="p">:</span> <span class="s">&quot;41000_sqli,</span><span class="nv"> </span><span class="s">42000_xss&quot;</span>
</code></pre></div>
<p>will ignore the two mentioned rulesets.</p>
<p>It is also possible to configure custom WAF rules per ingress using the <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf-extra-rules</code> annotation. For an example the following snippet will configure a WAF rule to deny requests with query string value that contains word <code class="codehilite">foo</code>:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-extra-rules</span><span class="p">:</span> <span class="s">&#39;[=[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">&quot;access&quot;:</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">&quot;actions&quot;:</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">&quot;disrupt&quot;</span><span class="nv"> </span><span class="s">:</span><span class="nv"> </span><span class="s">&quot;DENY&quot;</span><span class="nv"> </span><span class="s">},</span><span class="nv"> </span><span class="s">&quot;id&quot;:</span><span class="nv"> </span><span class="s">10001,</span><span class="nv"> </span><span class="s">&quot;msg&quot;:</span><span class="nv"> </span><span class="s">&quot;my</span><span class="nv"> </span><span class="s">custom</span><span class="nv"> </span><span class="s">rule&quot;,</span><span class="nv"> </span><span class="s">&quot;operator&quot;:</span><span class="nv"> </span><span class="s">&quot;STR_CONTAINS&quot;,</span><span class="nv"> </span><span class="s">&quot;pattern&quot;:</span><span class="nv"> </span><span class="s">&quot;foo&quot;,</span><span class="nv"> </span><span class="s">&quot;vars&quot;:</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">&quot;parse&quot;:</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">&quot;values&quot;,</span><span class="nv"> </span><span class="s">1</span><span class="nv"> </span><span class="s">],</span><span class="nv"> </span><span class="s">&quot;type&quot;:</span><span class="nv"> </span><span class="s">&quot;REQUEST_ARGS&quot;</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">]</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">],</span><span class="nv"> </span><span class="s">&quot;body_filter&quot;:</span><span class="nv"> </span><span class="s">[],</span><span class="nv"> </span><span class="s">&quot;header_filter&quot;:[]</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">]=]&#39;</span>
</pre></div>
<p>It is also possible to configure custom WAF rules per ingress using the <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/lua-resty-waf-extra-rules</span></code> annotation. For an example the following snippet will configure a WAF rule to deny requests with query string value that contains word <code class="codehilite"><span class="err">foo</span></code>:</p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-extra-rules</span><span class="p">:</span> <span class="s">&#39;[=[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">&quot;access&quot;:</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">&quot;actions&quot;:</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">&quot;disrupt&quot;</span><span class="nv"> </span><span class="s">:</span><span class="nv"> </span><span class="s">&quot;DENY&quot;</span><span class="nv"> </span><span class="s">},</span><span class="nv"> </span><span class="s">&quot;id&quot;:</span><span class="nv"> </span><span class="s">10001,</span><span class="nv"> </span><span class="s">&quot;msg&quot;:</span><span class="nv"> </span><span class="s">&quot;my</span><span class="nv"> </span><span class="s">custom</span><span class="nv"> </span><span class="s">rule&quot;,</span><span class="nv"> </span><span class="s">&quot;operator&quot;:</span><span class="nv"> </span><span class="s">&quot;STR_CONTAINS&quot;,</span><span class="nv"> </span><span class="s">&quot;pattern&quot;:</span><span class="nv"> </span><span class="s">&quot;foo&quot;,</span><span class="nv"> </span><span class="s">&quot;vars&quot;:</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">&quot;parse&quot;:</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">&quot;values&quot;,</span><span class="nv"> </span><span class="s">1</span><span class="nv"> </span><span class="s">],</span><span class="nv"> </span><span class="s">&quot;type&quot;:</span><span class="nv"> </span><span class="s">&quot;REQUEST_ARGS&quot;</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">]</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">],</span><span class="nv"> </span><span class="s">&quot;body_filter&quot;:</span><span class="nv"> </span><span class="s">[],</span><span class="nv"> </span><span class="s">&quot;header_filter&quot;:[]</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">]=]&#39;</span>
</code></pre></div>
<p>Since the default allowed contents were <code class="codehilite">&quot;text/html&quot;, &quot;text/json&quot;, &quot;application/json&quot;</code>
<p>Since the default allowed contents were <code class="codehilite"><span class="err">&quot;text/html&quot;, &quot;text/json&quot;, &quot;application/json&quot;</span></code>
We can enable the following annotation for allow all contents type:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-allow-unknown-content-types</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-allow-unknown-content-types</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</code></pre></div>
<p>The default score of lua-resty-waf is 5, which usually triggered if hitting 2 default rules, you can modify the score threshold with following annotation:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-score-threshold</span><span class="p">:</span> <span class="s">&quot;10&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-score-threshold</span><span class="p">:</span> <span class="s">&quot;10&quot;</span>
</code></pre></div>
<p>When you enabled HTTPS in the endpoint and since resty-lua will return 500 error when processing "multipart" contents
Reference for this <a href="https://github.com/p0pr0ck5/lua-resty-waf/issues/166">issue</a></p>
<p>By default, it will be "true"</p>
<p>You may enable the following annotation for work around:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-process-multipart-body</span><span class="p">:</span> <span class="s">&quot;false&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/lua-resty-waf-process-multipart-body</span><span class="p">:</span> <span class="s">&quot;false&quot;</span>
</code></pre></div>
<p>For details on how to write WAF rules, please refer to <a href="https://github.com/p0pr0ck5/lua-resty-waf">https://github.com/p0pr0ck5/lua-resty-waf</a>.</p>
<h3 id="modsecurity">ModSecurity<a class="headerlink" href="#modsecurity" title="Permanent link"></a></h3>
@ -2908,45 +2911,45 @@ of ingress locations. The ModSecurity module must first be enabled by enabling M
<a href="../configmap/#enable-modsecurity">ConfigMap</a>. Note this will enable ModSecurity for all paths, and each path
must be disabled manually.</p>
<p>It can be enabled using the following annotation:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/enable-modsecurity</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/enable-modsecurity</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</code></pre></div>
ModSecurity will run in "Detection-Only" mode using the <a href="https://github.com/SpiderLabs/ModSecurity/blob/v3/master/modsecurity.conf-recommended">recommended configuration</a>.</p>
<p>You can enable the <a href="https://www.modsecurity.org/CRS/Documentation/">OWASP Core Rule Set</a> by
setting the following annotation:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/enable-owasp-core-rules</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</pre></div></p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/enable-owasp-core-rules</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</code></pre></div></p>
<p>You can pass transactionIDs from nginx by setting up the following:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/modsecurity-transaction-id</span><span class="p">:</span> <span class="s">&quot;$request_id&quot;</span>
</pre></div></p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/modsecurity-transaction-id</span><span class="p">:</span> <span class="s">&quot;$request_id&quot;</span>
</code></pre></div></p>
<p>You can also add your own set of modsecurity rules via a snippet:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/modsecurity-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/modsecurity-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<span class="l l-Scalar l-Scalar-Plain">SecRuleEngine On</span>
<span class="l l-Scalar l-Scalar-Plain">SecDebugLog /tmp/modsec_debug.log</span>
</pre></div></p>
<p>Note: If you use both <code class="codehilite">enable-owasp-core-rules</code> and <code class="codehilite">modsecurity-snippet</code> annotations together, only the
<code class="codehilite">modsecurity-snippet</code> will take effect. If you wish to include the <a href="https://www.modsecurity.org/CRS/Documentation/">OWASP Core Rule Set</a> or
</code></pre></div></p>
<p>Note: If you use both <code class="codehilite"><span class="err">enable-owasp-core-rules</span></code> and <code class="codehilite"><span class="err">modsecurity-snippet</span></code> annotations together, only the
<code class="codehilite"><span class="err">modsecurity-snippet</span></code> will take effect. If you wish to include the <a href="https://www.modsecurity.org/CRS/Documentation/">OWASP Core Rule Set</a> or
<a href="https://github.com/SpiderLabs/ModSecurity/blob/v3/master/modsecurity.conf-recommended">recommended configuration</a> simply use the include
statement:</p>
<p>nginx 0.24.1 and below
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/modsecurity-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/modsecurity-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<span class="l l-Scalar l-Scalar-Plain">Include /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf</span>
<span class="l l-Scalar l-Scalar-Plain">Include /etc/nginx/modsecurity/modsecurity.conf</span>
</pre></div>
</code></pre></div>
nginx 0.25.0 and above
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/modsecurity-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/modsecurity-snippet</span><span class="p">:</span> <span class="p p-Indicator">|</span>
<span class="l l-Scalar l-Scalar-Plain">Include /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf</span>
</pre></div></p>
</code></pre></div></p>
<h3 id="influxdb">InfluxDB<a class="headerlink" href="#influxdb" title="Permanent link"></a></h3>
<p>Using <code class="codehilite">influxdb-*</code> annotations we can monitor requests passing through a Location by sending them to an InfluxDB backend exposing the UDP socket
<p>Using <code class="codehilite"><span class="err">influxdb-*</span></code> annotations we can monitor requests passing through a Location by sending them to an InfluxDB backend exposing the UDP socket
using the <a href="https://github.com/influxdata/nginx-influxdb-module/">nginx-influxdb-module</a>.</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/enable-influxdb</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/enable-influxdb</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
<span class="nt">nginx.ingress.kubernetes.io/influxdb-measurement</span><span class="p">:</span> <span class="s">&quot;nginx-reqs&quot;</span>
<span class="nt">nginx.ingress.kubernetes.io/influxdb-port</span><span class="p">:</span> <span class="s">&quot;8089&quot;</span>
<span class="nt">nginx.ingress.kubernetes.io/influxdb-host</span><span class="p">:</span> <span class="s">&quot;127.0.0.1&quot;</span>
<span class="nt">nginx.ingress.kubernetes.io/influxdb-server-name</span><span class="p">:</span> <span class="s">&quot;nginx-ingress&quot;</span>
</pre></div>
</code></pre></div>
<p>For the <code class="codehilite">influxdb-host</code> parameter you have two options:</p>
<p>For the <code class="codehilite"><span class="err">influxdb-host</span></code> parameter you have two options:</p>
<ul>
<li>Use an InfluxDB server configured with the <a href="https://docs.influxdata.com/influxdb/v1.5/supported_protocols/udp/">UDP protocol</a> enabled.</li>
<li>Deploy Telegraf as a sidecar proxy to the Ingress controller configured to listen UDP with the <a href="https://github.com/influxdata/telegraf/tree/release-1.6/plugins/inputs/socket_listener">socket listener input</a> and to write using
@ -2954,51 +2957,52 @@ anyone of the <a href="https://github.com/influxdata/telegraf/tree/release-1.7/p
Prometheus, etc.. (recommended)</li>
</ul>
<p>It's important to remember that there's no DNS resolver at this stage so you will have to configure
an ip address to <code class="codehilite">nginx.ingress.kubernetes.io/influxdb-host</code>. If you deploy Influx or Telegraf as sidecar (another container in the same pod) this becomes straightforward since you can directly use <code class="codehilite">127.0.0.1</code>.</p>
an ip address to <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/influxdb-host</span></code>. If you deploy Influx or Telegraf as sidecar (another container in the same pod) this becomes straightforward since you can directly use <code class="codehilite"><span class="err">127.0.0.1</span></code>.</p>
<h3 id="backend-protocol">Backend Protocol<a class="headerlink" href="#backend-protocol" title="Permanent link"></a></h3>
<p>Using <code class="codehilite">backend-protocol</code> annotations is possible to indicate how NGINX should communicate with the backend service. (Replaces <code class="codehilite">secure-backends</code> in older versions)
<p>Using <code class="codehilite"><span class="err">backend-protocol</span></code> annotations is possible to indicate how NGINX should communicate with the backend service. (Replaces <code class="codehilite"><span class="err">secure-backends</span></code> in older versions)
Valid Values: HTTP, HTTPS, GRPC, GRPCS and AJP</p>
<p>By default NGINX uses <code class="codehilite">HTTP</code>.</p>
<p>By default NGINX uses <code class="codehilite"><span class="err">HTTP</span></code>.</p>
<p>Example:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/backend-protocol</span><span class="p">:</span> <span class="s">&quot;HTTPS&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/backend-protocol</span><span class="p">:</span> <span class="s">&quot;HTTPS&quot;</span>
</code></pre></div>
<h3 id="use-regex">Use Regex<a class="headerlink" href="#use-regex" title="Permanent link"></a></h3>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>When using this annotation with the NGINX annotation <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/affinity</span></code> of type <code class="codehilite"><span class="err">cookie</span></code>, <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/session-cookie-path</span></code> must be also set; Session cookie paths do not support regex.</p>
</div>
<p>When using this annotation with the NGINX annotation <code class="codehilite">nginx.ingress.kubernetes.io/affinity</code> of type <code class="codehilite">cookie</code>, <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-path</code> must be also set; Session cookie paths do not support regex.</p>
<p>Using the <code class="codehilite">nginx.ingress.kubernetes.io/use-regex</code> annotation will indicate whether or not the paths defined on an Ingress use regular expressions. The default value is <code class="codehilite">false</code>.</p>
<p>Using the <code class="codehilite"><span class="err">nginx.ingress.kubernetes.io/use-regex</span></code> annotation will indicate whether or not the paths defined on an Ingress use regular expressions. The default value is <code class="codehilite"><span class="err">false</span></code>.</p>
<p>The following will indicate that regular expression paths are being used:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/use-regex</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</pre></div></p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/use-regex</span><span class="p">:</span> <span class="s">&quot;true&quot;</span>
</code></pre></div></p>
<p>The following will indicate that regular expression paths are <strong>not</strong> being used:
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/use-regex</span><span class="p">:</span> <span class="s">&quot;false&quot;</span>
</pre></div></p>
<p>When this annotation is set to <code class="codehilite">true</code>, the case insensitive regular expression <a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#location">location modifier</a> will be enforced on ALL paths for a given host regardless of what Ingress they are defined on.</p>
<p>Additionally, if the <a href="#rewrite"><code class="codehilite">rewrite-target</code> annotation</a> is used on any Ingress for a given host, then the case insensitive regular expression <a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#location">location modifier</a> will be enforced on ALL paths for a given host regardless of what Ingress they are defined on.</p>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/use-regex</span><span class="p">:</span> <span class="s">&quot;false&quot;</span>
</code></pre></div></p>
<p>When this annotation is set to <code class="codehilite"><span class="err">true</span></code>, the case insensitive regular expression <a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#location">location modifier</a> will be enforced on ALL paths for a given host regardless of what Ingress they are defined on.</p>
<p>Additionally, if the <a href="#rewrite"><code class="codehilite"><span class="err">rewrite-target</span></code> annotation</a> is used on any Ingress for a given host, then the case insensitive regular expression <a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#location">location modifier</a> will be enforced on ALL paths for a given host regardless of what Ingress they are defined on.</p>
<p>Please read about <a href="../../ingress-path-matching/">ingress path matching</a> before using this modifier.</p>
<h3 id="satisfy">Satisfy<a class="headerlink" href="#satisfy" title="Permanent link"></a></h3>
<p>By default, a request would need to satisfy all authentication requirements in order to be allowed. By using this annotation, requests that satisfy either any or all authentication requirements are allowed, based on the configuration value.</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/satisfy</span><span class="p">:</span> <span class="s">&quot;any&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/satisfy</span><span class="p">:</span> <span class="s">&quot;any&quot;</span>
</code></pre></div>
<h3 id="mirror">Mirror<a class="headerlink" href="#mirror" title="Permanent link"></a></h3>
<p>Enables a request to be mirrored to a mirror backend. Responses by mirror backends are ignored. This feature is useful, to see how requests will react in "test" backends.</p>
<p>The mirror backend can be set by applying:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/mirror-target</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">https://test.env.com/$request_uri</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/mirror-target</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">https://test.env.com/$request_uri</span>
</code></pre></div>
<p>By default the request-body is sent to the mirror backend, but can be turned off by applying:</p>
<div class="codehilite"><pre><span></span><span class="nt">nginx.ingress.kubernetes.io/mirror-request-body</span><span class="p">:</span> <span class="s">&quot;off&quot;</span>
</pre></div>
<div class="codehilite"><pre><span></span><code><span class="nt">nginx.ingress.kubernetes.io/mirror-request-body</span><span class="p">:</span> <span class="s">&quot;off&quot;</span>
</code></pre></div>
<p><strong>Note:</strong> The mirror directive will be applied to all paths within the ingress resource.</p>
<p>The request sent to the mirror is linked to the orignial request. If you have a slow mirror backend, then the orignial request will throttle.</p>
<p>For more information on the mirror module see https://nginx.org/en/docs/http/ngx_http_mirror_module.html</p>
<p>For more information on the mirror module see <a href="https://nginx.org/en/docs/http/ngx_http_mirror_module.html">ngx_http_mirror_module</a></p>
@ -3053,9 +3057,9 @@ Valid Values: HTTP, HTTPS, GRPC, GRPCS and AJP</p>
<div class="md-footer-copyright">
powered by
<a href="https://www.mkdocs.org">MkDocs</a>
<a href="https://www.mkdocs.org" target="_blank" rel="noopener">MkDocs</a>
and
<a href="https://squidfunk.github.io/mkdocs-material/">
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs</a>
</div>
@ -3065,7 +3069,7 @@ Valid Values: HTTP, HTTPS, GRPC, GRPCS and AJP</p>
</div>
<script src="../../../assets/javascripts/application.ac79c3b0.js"></script>
<script src="../../../assets/javascripts/application.c33a9706.js"></script>
<script>app.initialize({version:"1.0.4",url:{base:"../../.."}})</script>