You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/customization/README.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,13 +13,22 @@ The table below summarizes some of the options. More options (extensions) are av
13
13
|`nginx.org/proxy-buffers`|`proxy-buffers`| Sets the value of the [proxy_buffers](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers) directive. | Depends on the platform. |
14
14
|`nginx.org/proxy-buffer-size`|`proxy-buffer-size`| Sets the value of the [proxy_buffer_size](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size) directive | Depends on the platform. |
15
15
|`nginx.org/proxy-max-temp-file-size`|`proxy-max-temp-file-size`| Sets the value of the [proxy_max_temp_file_size](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_max_temp_file_size) directive. |`1024m`|
16
+
|`nginx.org/proxy-hide-headers`|`proxy-hide-headers`| Sets the value of one or more [proxy_hide_header](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header) directives. Example: `"nginx.org/proxy-hide-headers": "header-a,header-b"`| N/A |
17
+
|`nginx.org/proxy-pass-headers`|`proxy-pass-headers`| Sets the value of one or more [proxy_pass_header](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass_header) directives. Example: `"nginx.org/proxy-pass-headers": "header-a,header-b"`| N/A |
16
18
| N/A |`server-names-hash-bucket-size`| Sets the value of the [server_names_hash_max_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#server_names_hash_max_size) directive. | Depends on the size of the processor’s cache line. |
17
19
| N/A |`server-names-hash-max-size`| Sets the value of the [server_names_hash_bucket_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#server_names_hash_bucket_size) directive. |`512`|
18
20
|`nginx.org/http2`|`http2`| Enables HTTP/2 in servers with SSL enabled. To support HTTP/2 for Chrome users, use the provided controller image based on the alpine Linux. It includes OpenSSL with ALPN support, [necessary for Chrome users](https://www.nginx.com/blog/supporting-http2-google-chrome-users/). |`False`|
19
21
| N/A |`log-format`| Sets the custom [log format](http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format). | See the [template file](../../nginx-controller/nginx/nginx.conf.tmpl). |
20
22
|`nginx.org/hsts`|`hsts`| Enables [HTTP Strict Transport Security (HSTS)](https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/): the HSTS header is added to the responses from backends. The `preload` directive is included in the header. |`False`|
21
23
|`nginx.org/hsts-max-age`|`hsts-max-age`| Sets the value of the `max-age` directive of the HSTS header. |`2592000` (1 month) |
22
24
|`nginx.org/hsts-include-subdomains`|`hsts-include-subdomains`| Adds the `includeSubDomains` directive to the HSTS header. |`False`|
25
+
| N/A |`ssl-protocols`| Sets the value of the [ssl_protocols](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_protocols) directive. |`TLSv1 TLSv1.1 TLSv1.2`|
26
+
| N/A |`ssl-prefer-server-cipher`| Enables or disables the [ssl_prefer_server_ciphers](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_prefer_server_ciphers) directive. |`False`|
27
+
| N/A |`ssl-ciphers`| Sets the value of the [ssl_ciphers](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ciphers) directive. |`HIGH:!aNULL:!MD5`|
28
+
| N/A |`ssl-dhparam-file`| Sets the content of the dhparam file. The controller will create the file and set the value of the [ssl_dhparam](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_dhparam) directive with the path of the file. | N/A|
29
+
| N/A |`set-real-ip-from`| Sets the value of the [set_real_ip_from](http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from) directive. | N/A |
30
+
| N/A |`real-ip-header`| Sets the value of the [real_ip_header](http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header) directive. |`X-Real-IP`|
31
+
| N/A |`real-ip-recursive`| Enables or disables the [real_ip_recursive](http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_recursive) directive. |`False`|
Copy file name to clipboardExpand all lines: examples/customization/nginx-config.yaml
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ metadata:
5
5
data:
6
6
proxy-connect-timeout: "10s"# default is "60s". See http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout
7
7
proxy-read-timeout: "10s"# default is "60s". See http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout
8
+
proxy-hide-headers: "header-a,header-b"# No default. Sets the value of one or more proxy_hide_header directives. See http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header
9
+
proxy-pass-headers: "header-a,header-b"# No default. Sets the value of one or more proxy_pass_header directives. See http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass_header
8
10
client-max-body-size: "2m"# default is "1m". See http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
9
11
server-names-hash-bucket-size: "64"# default value depends on the size of the processor’s cache line. See http://nginx.org/en/docs/http/ngx_http_core_module.html#server_names_hash_bucket_size
10
12
server-names-hash-max-size: "1024"# default is "512". See http://nginx.org/en/docs/http/ngx_http_core_module.html#server_names_hash_max_size
@@ -18,3 +20,14 @@ data:
18
20
hsts: "True"# default is "False". Enables HTTP Strict Transport Security (HSTS): the HSTS header is added to the responses from backends. See https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/
19
21
hsts-max-age: "31536000"# default is 2592000 (1 month).
20
22
hsts-include-subdomains: "True"# default is "False".
23
+
ssl-protocols: "TLSv1.2"# default is "TLSv1 TLSv1.1 TLSv1.2". See http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_protocols
24
+
ssl-prefer-server-cipher: "True"# default is "False". Enables or disables the ssl_prefer_server_ciphers directive. See http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_prefer_server_ciphers
25
+
ssl-ciphers: "HIGH:!aNULL:!MD5"# default is "HIGH:!aNULL:!MD5". See http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ciphers
26
+
ssl-dhparam-file: |
27
+
-----BEGIN DH PARAMETERS-----
28
+
...
29
+
-----END DH PARAMETERS-----
30
+
# Sets the content of the dhparam file. The controller will create the file and set the value of the ssl_dhparam directive with the path of the file. Also see http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_dhparam
31
+
set-real-ip-from: "192.168.192.168"# No default. Sets the value of the set_real_ip_from directive. See http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
32
+
real-ip-header: "proxy_protocol"# default is X-Real-IP. Sets the value of the real_ip_header directive. http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
33
+
real-ip-recursive: "True"# default is "False". Enables or disables the real_ip_recursive directive. See http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_recursive
Proxies and load balancers, such as HAProxy or ELB, can pass the client's information (the IP address and the port) to the next proxy or load balancer via the PROXY Protocol. To enable NGINX Ingress controller to receive that information, use the `proxy-protocol` ConfigMaps configuration key as well as the `real-ip-header` and the `set-real-ip-from` keys. Once you enable the PROXY Protocol, it is enabled for every Ingress resource.
4
+
5
+
## Syntax
6
+
7
+
The `proxy-protocol` key syntax is as follows:
8
+
```
9
+
proxy-protocol: "True | False"
10
+
```
11
+
12
+
Additionally, you must configure the following keys:
13
+
***real-ip-header**: Set its value to `proxy_protocol`.
14
+
***set-real-ip-from**: Set its value to the IP address or the subnet of the proxy or the load balancer. See http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
15
+
16
+
## Example
17
+
18
+
In the example below we configure the PROXY Protocol via a ConfigMaps resource. The IP address of the proxy which is in front of the Ingress controller is `192.168.192.168`.
19
+
20
+
```yaml
21
+
kind: ConfigMap
22
+
apiVersion: v1
23
+
metadata:
24
+
name: nginx-config
25
+
data:
26
+
proxy-protocol: "True"
27
+
real-ip-header: "proxy_protocol"
28
+
set-real-ip-from: "192.168.192.168"
29
+
```
30
+
After we create the ConfigMaps resource, in the NGINX configuration the client's IP address is available via the `$remote_addr` variable. By default, NGINX Ingress controller logs the value of this variable and also passes the value to the backend service in the `X-Real-IP` header.
0 commit comments