ConfigMaps

ConfigMap允许您将配置工件与图像内容分离,以使容器化的应用程序具有可移植性。

ConfigMap API资源将配置数据存储为键值对。 数据提供系统的配置 Nginx控制器的组件。

为了覆盖nginx-controller配置值,可以在 config.go中看到, 您可以将键值对添加到config-map的data部分。 例如

data:
  map-hash-bucket-size: "128"
  ssl-protocols: SSLv2

!!! 重要 ConfigMap中的键和值只能是字符串。这意味着我们想要一个带有布尔值的值,我们需要用引号将它们引号,例如'true'或'false'。 数字也一样,例如'100'。

"Slice" 类型 (可以定义为 `[]string` 或 `[]int` 可以以逗号分隔的字符串形式提供.

Configuration options

下表显示了配置选项的名称,类型和默认值:

name

type

default

string

""

string array

empty

string

"/var/log/nginx/access.log"

string

"/var/log/nginx/error.log"

bool

false

string

"notice"

bool

"true"

string

"15724800"

bool

"false"

string

$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$proxy_upstream_name] [$proxy_alternative_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id

string

[$remote_addr] [$time_local] $protocol $status $bytes_sent $bytes_received $session_time

[]string

"127.0.0.1"

[]string

"0.0.0.0/0"

int

<size of the processor’s cache line>

bool

"true"

bool

"true"

string

"ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256"

string

"auto"

string

""

string

"TLSv1.2"

string

<Randomly Generated>

string

"4k"

bool

"true"

bool

"true"

bool

"false"

bool

"false"

string

"application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/javascript text/plain text/x-component"

bool

"true"

string

"application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/javascript text/plain text/x-component"

string

<Number of CPUs>

string

"round_robin"

string

"$binary_remote_addr"

[]string

""

string

"X-Forwarded-For"

string

"nginx"

string

"nginx"

string

"const"

string

uber-debug-id

string

jaeger-baggage

string

""

string

""

[]int

[]int{}

string

"1m"

string

"error timeout"

bool

"true"

[]string

[]string{}

[]string

[]string{}

string

"off"

string

"/.well-known/acme-challenge"

string

"200 202 401 5m"

string

"/.well-known/acme-challenge"

[]string

""

[]string

""

add-headers

在将流量发送到客户端之前,从命名的configmap设置自定义标头. 查看 proxy-set-headers. example

allow-backend-server-header

启用从后端返回标头服务器,而不是从通用nginx字符串返回. 默认: 禁用

hide-headers

设置不会从上游服务器传递到客户端响应的其他标头. default:

引用: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header

access-log-params

access_log的其他参数。 例如, buffer=16k, gzip, flush=1m

引用: http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log

access-log-path

访问日志路径。 默认查看 /var/log/nginx/access.log .

Note: 该文件 /var/log/nginx/access.log/dev/stdout的软连接

enable-access-log-for-default-backend

启用对默认后端的日志记录访问. default: is disabled.

error-log-path

错误日志路径. 默认查看 /var/log/nginx/error.log.

Note: 该文件 /var/log/nginx/error.log/dev/stderr的软连接

引用: http://nginx.org/en/docs/ngx_core_module.html#error_log

enable-modsecurity

为NGINX启用modsecurity模块. default: is disabled

enable-owasp-modsecurity-crs

启用OWASP ModSecurity核心规则集 (CRS). default: is disabled

modsecurity-snippet

Adds custom rules to modsecurity section of nginx configration

client-header-buffer-size

向Nginx配置的modsecurity部分添加自定义规则

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_buffer_size

client-header-timeout

定义读取客户端请求标头的超时(以秒为单位)

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_timeout

client-body-buffer-size

设置用于读取客户端请求正文的缓冲区大小。

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size

client-body-timeout

62/5000 定义读取客户端请求正文的超时时间(以秒为单位)。

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_timeout

disable-access-log

禁用整个Ingress Controller的访问日志. default: '"false"'

References: http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log

disable-ipv6

禁用监听IPV6. default: false; IPv6 listening is enabled

disable-ipv6-dns

为nginx DNS解析器禁用IPV6. default: false; IPv6 resolving enabled.

enable-underscores-in-headers

在header中启用下划线. default: is disabled

ignore-invalid-headers

设置是否忽略具有无效名称的头字段。 default: is enabled

retry-non-idempotent

从1.9.13开始,如果上游服务器发生错误,NGINX将不重试非幂等请求(POST,LOCK,PATCH)。 可以使用值'true'恢复以前的行为。

error-log-level

配置错误的日志记录级别。 上面的日志级别按严重性从高到低的顺序列出。

References: http://nginx.org/en/docs/ngx_core_module.html#error_log

http2-max-field-size

限制HPACK压缩的请求标头字段的最大大小。

References: https://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_field_size

http2-max-header-size

限制HPACK解压缩后整个请求标头列表的最大大小。

References: https://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_header_size

http2-max-requests

设置可以通过一个HTTP /2连接提供服务的最大请求数(包括推送请求),此后下一个客户端请求将导致连接关闭以及需要建立新连接。

References: http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_requests

hsts

在运行SSL的服务器中启用或禁用标头HSTS。 HTTP严格传输安全性(通常缩写为HSTS)是一项安全功能(HTTP标头),它告诉浏览器仅应使用HTTPS而不是HTTP进行通信。 它提供了针对协议降级攻击和cookie盗窃的保护。

References:

hsts-include-subdomains

在服务器名称的所有子域中启用或禁用HSTS。

hsts-max-age

设置浏览器记住该站点仅使用HTTPS访问的时间(以秒为单位)。

hsts-preload

启用或禁用HSTS功能中的preload属性(启用时)

keep-alive

设置保持活动的客户端连接在服务器端保持打开状态的时间。 零值将禁用保持活动状态的客户端连接。

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout

keep-alive-requests

设置可以通过一个保持活动连接服务的最大请求数。

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_requests

large-client-header-buffers

设置用于读取大型客户端请求标头的缓冲区的最大数量和大小. default: 4 8k

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers

log-format-escape-json

设置转义参数是否允许JSON("true")或在变量中转义的默认字符("false")设置nginx 日志格式.

log-format-upstream

设置nginx 日志格式. 例如json输出

log-format-upstream: '{"time": "$time_iso8601", "remote_addr": "$proxy_protocol_addr", "x-forward-for": "$proxy_add_x_forwarded_for", "request_id": "$req_id",
  "remote_user": "$remote_user", "bytes_sent": $bytes_sent, "request_time": $request_time, "status":$status, "vhost": "$host", "request_proto": "$server_protocol",
  "path": "$uri", "request_query": "$args", "request_length": $request_length, "duration": $request_time,"method": "$request_method", "http_referrer": "$http_referer",
  "http_user_agent": "$http_user_agent" }'

请查看 log-format 从而定义各个字段.

log-format-stream

查看nginx stream format.

enable-multi-accept

如果禁用,worker进程将一次接受一个新连接。 否则,工作进程将一次接受所有新连接。 default: true

References: http://nginx.org/en/docs/ngx_core_module.html#multi_accept

max-worker-connections

设置 单个worker打开的最大同时连接数. 0 讲使用值 max-worker-open-files. default: 16384

!!! 小提示 在高负载的情况下使用0可以提高性能,但以增加RAM利用率(甚至在空闲时)为代价。

max-worker-open-files

设置每个工作进程可以打开的 最大文件数 that can be opened by each worker process. 默认为0以为着 "最大打开文件数 (系统限制) /worker-processes - 1024". default: 0

map-hash-bucket-size

28/5000 设置桶的尺寸 map variables hash tables. 单独设置哈希表的详细信息 文档.

proxy-real-ip-cidr

如果启用了use-proxy-protocol,则proxy-real-ip-cidr定义默认的外部负载均衡器的IP /网络地址

proxy-set-headers

在将流量发送到后端之前,从命名的configmap设置自定义标头。 值格式为名称空间/名称. 查看 example

server-name-hash-max-size

设置最大尺寸 server names hash tables 用于服务器名称,map指令的值,MIME类型,请求标头字符串的名称等。.

References: http://nginx.org/en/docs/hash.html

server-name-hash-bucket-size

设置服务器名称哈希表的存储桶大小。

References:

proxy-headers-hash-max-size

设置代理标头哈希表的最大大小。

References:

reuse-port

指示NGINX为每个工作进程创建一个单独的侦听套接字(使用SOREUSEPORT套接字选项),从而允许内核在工作进程之间分配传入的连接 default:_ true

proxy-headers-hash-bucket-size

设置代理标头哈希表的存储桶大小。

References:

server-tokens

在响应中发送nginx Server标头,并在错误页面中显示NGINX版本. default: is enabled

ssl-ciphers

设置启用的 ciphers 列表. ciphers以OpenSSL库可以理解的格式指定.

默认cipher列表: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256.

密码套件的排序非常重要,因为它决定了优先选择哪些算法. 上面的建议优先考虑了提供完美 forward secrecy算法.

请检查 Mozilla SSL Configuration Generator.

ssl-ecdh-curve

指定ECDHE ciphers的曲线.

References: http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ecdh_curve

ssl-dh-param

设置包含Diffie-Hellman密钥的机密名称,以帮助实现"Perfect Forward Secrecy"。

References:

ssl-protocols

设置要使用的 SSL protocols . 默认值为: TLSv1.2.

请使用 https://ssllabs.com/ssltest/analyze.htmlhttps://testssl.sh检查配置结果.

ssl-early-data

启用或禁用TLS 1.3 early data

这要求 ssl-protocols 已启用 TLSv1.3.

ssl_early_data. The default is: false.

ssl-session-cache

启用或禁用工作进程之间共享 SSL cache 的使用.

ssl-session-cache-size

设置所有工作进程之间的 SSL shared session cache between all worker processes.

ssl-session-tickets

启用或禁用会话恢复通过 TLS session tickets.

ssl-session-ticket-key

设置用于加密和解密TLS会话票证的密钥。该值必须是有效的base64字符串。要创建票证: openssl rand 80 | openssl enc -A -base64

TLS session ticket-key, by default, a randomly generated key is used.

ssl-session-timeout

设置客户可以在这段时间内 重用 session 存储在缓存中的参数.

ssl-buffer-size

设置 SSL buffer 发送数据的缓冲大小. 默认的4k可以帮助NGINX缩短TLS首个字节的时间 (TTTFB).

引用: https://www.igvita.com/2013/12/16/optimizing-nginx-tls-time-to-first-byte/

use-proxy-protocol

启用或禁用 PROXY protocol 接收客户端IP (真实IP地址) 信息通过代理服务器和负载均衡器(例如HAProxy和Amazon Elastic Load Balancer)传递 (ELB).

proxy-protocol-header-timeout

设置用于接收代理协议标头的超时值. 默认值为5秒可防止TLS直通处理程序无限期地等待断开的连接。. default: 5s

use-gzip

使用启用或禁用HTTP响应的压缩 "gzip" module. 要压缩的MIME类型由由 gzip-types控制. default: true

use-geoip

启用或禁用 "geoip" module 它使用预编译的MaxMind数据库创建变量,其值取决于客户端IP地址。. default: true

Note: MaxMind legacy databases are discontinued and will not receive updates after 2019-01-02, cf. discontinuation notice. Consider use-geoip2 below.

use-geoip2

为NGINX启用 geoip2 module. default: false

enable-brotli

使用启用或禁用HTTP响应的压缩 "brotli" module. 要压缩的默认mime类型列表为: application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component. default: is disabled

Note: Brotli 不能在 Safari < 11运行. 获取更多信息查看 https://caniuse.com/#feat=brotli

brotli-level

设置将使用的Brotli压缩级别. default: 4

brotli-types

设置将由brotli即时压缩的MIME类型. default: application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component

use-http2

开启或禁用 HTTP/2 support in secure connections.

gzip-level

设置将使用的gzip压缩级别. default: 5

gzip-types

设置除"text/html"之外的MIME类型以进行压缩。 特殊值"*"与任何MIME类型匹配。 如果启用了use-gzip,则始终会压缩'text/html'类型的响应。 _**default:**_application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component`.

worker-processes

设置 worker processes数量. 默认值"auto"表示可用的CPU内核数.

worker-cpu-affinity

将工作进程绑定到CPU组. worker_cpu_affinity. 默认情况下,辅助进程未绑定到任何特定的CPU。 该值可以是:

  • "": 空字符串表示未应用亲和力.

  • cpumask: e.g. 0001 0010 0100 1000 将进程绑定到特定的CPU.

  • auto: 自动将工作进程绑定到可用的CPU.

worker-shutdown-timeout

设置nginx 等待worker优雅停止的超时时间. default: "240s"

load-balance

设置用于负载均衡的算法. 该值可以是:

  • round_robin: 使用默认 round robin loadbalancer

  • ewma: 使用Peak EWMA 用于路由 (implementation)

默认是round_robin.

  • 要使用IP或其他变量的一致哈希进行负载平衡,请考虑 nginx.ingress.kubernetes.io/upstream-hash-by 注解.

  • 要使用会话Cookie进行负载均衡,请考虑 nginx.ingress.kubernetes.io/affinity 注解.

References: http://nginx.org/en/docs/http/load_balancing.html

variables-hash-bucket-size

设置变量哈希表的存储桶大小.

References: http://nginx.org/en/docs/http/ngx_http_map_module.html#variables_hash_bucket_size

variables-hash-max-size

设置变量哈希表的最大大小.

References: http://nginx.org/en/docs/http/ngx_http_map_module.html#variables_hash_max_size

upstream-keepalive-connections

激活缓存以连接到上游服务器。 connections参数设置最大空闲数 与上游服务器的保持活动连接,这些连接保留在每个工作进程的缓存中。 当这个数字是 如果超过,则关闭最近最少使用的连接 default: 32

References: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive

upstream-keepalive-timeout

设置一个超时,在此超时期间,与上游服务器的空闲keepalive连接将保持打开状态。 default: 60

References: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_timeout

upstream-keepalive-requests

设置可以通过一个Keepalive连接处理的最大请求数。 后最大数量 发出请求后,连接已关闭。 default: 100

References: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_requests

limit-conn-zone-variable

设置共享内存区域的参数,该参数将保持 limit_conn_zone各个键的状态. "$binary_remote_addr" 变量默认总是为IPV4地址设置 4 bytes 为IPv6 地址设置16bytes.

proxy-stream-timeout

设置客户端或代理服务器连接上的两次连续读取或写入操作之间的超时.如果在此时间内没有数据传输,则连接将关闭。

References: http://nginx.org/en/docs/stream/ngx_stream_proxy_module.html#proxy_timeout

proxy-stream-responses

如果使用UDP协议,则设置代理服务器响应客户端请求而期望的数据报数。

References: http://nginx.org/en/docs/stream/ngx_stream_proxy_module.html#proxy_responses

bind-address

设置服务器将接受请求而不是*的地址。 应该注意的是,这些地址必须存在于运行时环境中,否则控制器将崩溃。

use-forwarded-headers

如果为true,NGINX将传入的X-Forwarded- *标头传递给上游。 当NGINX在另一个正在设置这些标头的L7代理/负载平衡器之后时,请使用此选项。

如果为false,NGINX将忽略传入的X-Forwarded- *标头,并用看到的请求信息填充标头。 如果NGINX直接暴露于Internet或位于基于L3 /数据包的负载均衡器之后,而该负载均衡器不会更改数据包中的源IP,请使用此选项。

forwarded-for-header

设置标头字段以标识客户端的原始IP地址, default: X-Forwarded-For

compute-full-forwarded-for

将远程地址附加到X-Forwarded-For标头,而不是替换它。 启用此选项后,上游应用程序将根据其自己的受信任代理列表提取客户端IP。

proxy-add-original-uri-header

将具有原始请求URI的X-Original-Uri标头添加到后端请求

generate-request-id

如果请求中没有X-Request-ID,请确保X-Request-ID默认为随机值

enable-opentracing

启用nginx Opentracing扩展. default: is disabled

References: https://github.com/opentracing-contrib/nginx-opentracing

zipkin-collector-host

指定uploading traces时要使用的主机。 它必须是一个有效的URL。.

zipkin-collector-port

指定上载traces要使用的端口. default: 9411

zipkin-service-name

指定用于创建的任何traces的服务名称。 default: nginx

zipkin-sample-rate

指定创建的任何traces的采样率。 default: 1.0

jaeger-collector-host

指定上载traces时要使用的主机. It must be a valid URL.

jaeger-collector-port

指定上载跟踪时要使用的端口。 default: 6831

jaeger-service-name

指定用于创建的任何跟踪的服务名称 default: nginx

jaeger-sampler-type

指定采样轨迹时要使用的采样器。 可用的采样器为:const,概率,速率限制,远程。default: const

jaeger-sampler-param

指定要传递给采样器构造函数的参数。 必须是数字。 对于const,应为0(从不采样)和1(始终采样)。 default: 1

jaeger-sampler-host

指定要传递给采样器构造函数的自定义远程采样器主机。 必须是有效的网址。 保留空白以使用默认值(localhost)。 default: http://127.0.0.1

jaeger-sampler-port

指定要传递给采样器构造函数的自定义远程采样器端口。 必须是数字。 default: 5778

jaeger-trace-context-header-name

指定用于传递跟踪上下文的标头名称。 default: uber-trace-id

jaeger-debug-header

指定用于强制采样的标题名称 default: jaeger-debug-id

jaeger-baggage-header

指定没有根跨度时用于提交行李的标头名称。default: jaeger-baggage

jaeger-tracer-baggage-header-prefix

指定用于传播行李的标题前缀。default: uberctx-

main-snippet

将自定义配置添加到nginx配置的主要部分。

http-snippet

将自定义配置添加到nginx配置的http部分。

server-snippet

将自定义配置添加到nginx配置中的所有server。

location-snippet

将自定义配置添加到nginx配置中的所有location。

您不能使用它来添加代理到Kubernetes容器的新位置, 因为该代码段无法访问Go模板功能. 如果要添加自定义位置,则必须 提供你自己的 nginx.tmpl.

custom-http-errors

启用应传递哪些HTTP代码以使用 error_page directive

设置至少一个代码也会启用 proxy_intercept_errors.处理error_page需要哪些

例子: custom-http-errors: 404,415

proxy-body-size

设置客户端请求正文的最大允许大小。 查看 client_max_body_size.

proxy-connect-timeout

保持与代理服务器建立连接设置超时时间. 请注意,此超时通常不能超过75秒.

proxy-read-timeout

以秒为单位为 从代理服务器读取相应设置超时. 超时仅在两次连续的读取操作之间设置,而不用于传输整个响应。

proxy-send-timeout

以秒为单位为 向代理服务器发送请求设置超时时间. 超时仅在两次连续的写操作之间设置,而不用于传输整个请求.

proxy-buffers-number

从响应读取第一部分 从代理服务器接收的缓冲器数量. 这部分通常包含一个小的响应头.

proxy-buffer-size

r从响应读取第一部分 从代理服务器接收的缓冲区大小. 这部分通常包含一个小的响应头.

应该在path属性中更改 设置响应代理服务器投资端"Set-Cookie" 设置文本.

应该在domain属性中更改 设置响应代理服务器投资端"Set-Cookie" 设置文本.

proxy-next-upstream

指定 哪些情况 应该允许访问下一个服务器.

proxy-next-upstream-timeout

以秒为单温限制时间 当一个请求代理到下一个server.

proxy-next-upstream-tries

限制 允许重试次数, 当一个请求代理到下一个server.

proxy-redirect-from

设置应在代理服务器响应的"位置"和"刷新"标头字段中更改的原始文本. default: off

引用: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect

proxy-request-buffering

加载或禁用 缓存一个请求的请求体.

ssl-redirect

如果服务器具有TLS证书(在Ingress规则中定义),则将重定向(301)的全局值设置为HTTPS. default: "true"

whitelist-source-range

为每个"服务器"块设置默认列入白名单的IP。 这可以由Ingress规则上的注释覆盖。 See ngx_http_access_module.

skip-access-log-urls

设置不应出现在NGINX访问日志中的URL列表。 这对于像"/health"或"health-check"这样的使"复杂"的日志读取网址很有用。 默认值:为空

limit-rate

限制向客户端传输响应的速率。 该速率以每秒字节数指定。 零值禁用速率限制。 该限制是根据请求设置的,因此,如果客户端同时打开两个连接,则总速率将是指定限制的两倍。

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#limit_rate

limit-rate-after

设置初始数量,之后将进一步限制对客户端的响应的进一步传输。

lua-shared-dicts

自定义默认的Lua共享字典或定义更多。 您可以使用以下语法来这样做:

lua-shared-dicts: "<my dict name>: <my dict size>, [<my dict name>: <my dict size>], ..."

例如,下面的命令会将默认的"certificate_data"字典设置为"100M",并引入一个名为 my_custom_plugin:

lua-shared-dicts: "certificate_data: 100, my_custom_plugin: 5"

References: http://nginx.org/en/docs/http/ngx_http_core_module.html#limit_rate_after

http-redirect-code

设置要在重定向中使用的HTTP状态代码。 支持的状态为有 301,302,307 and 308 default: 308

为什么默认代码是308?

RFC 7238 被创建以定义308(永久重定向)状态代码,该状态代码与301(永久移动)相似,但是将有效负载保留在重定向中。 如果我们以POST之类的方法发送重定向,这一点很重要。

proxy-buffering

加载或禁用 缓冲来自代理服务器的响应.

limit-req-status-code

设置被拒绝请求返回的状态码. default: 503

limit-conn-status-code

设置 被拒绝链接返回的状态码. default: 503

no-tls-redirect-locations

以逗号分隔的位置列表,在这些位置上,http请求将永远不会重定向到其https副本. default: "/.well-known/acme-challenge"

global-auth-url

提供对所有位置进行身份验证的现有服务的URL. 与nginx.ingress.kubernetes.io/auth-url注解类似. 可以可出不应通过身份验证请求的location no-auth-locations 查看 no-auth-locations. 另外,可以通过设置enable-global-auth注解为false将每个服务从身份验证中排除。. default: ""

References: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#external-authentication

global-auth-method

一种用于现有服务的HTTP方法,该服务为所有位置提供身份验证。 与 nginx.ingress.kubernetes.io/auth-method注解类似. default: ""

global-auth-signin

设置现有服务的错误页面的位置,该服务为所有位置提供身份验证。 与 nginx.ingress.kubernetes.io/auth-signin注解类似. default: ""

global-auth-response-headers

将头设置为在身份验证请求完成后传递到后端。 应用于所有location。 与 nginx.ingress.kubernetes.io/auth-response-headers注解类似. default: ""

global-auth-request-redirect

设置X-Auth-Request-Redirect标头值。 适用于所有location 与 nginx.ingress.kubernetes.io/auth-request-redirect注解类似.. default: ""

global-auth-snippet

设置自定义代码段以与外部身份验证一起使用。 适用于所有地点 与 nginx.ingress.kubernetes.io/auth-request-redirect注解类似. default: ""

global-auth-cache-key

为全局身份验证请求启用缓存。 指定身份验证响应的查找键, e.g. $remote_user$http_authorization.

global-auth-cache-duration

根据验证响应的响应代码设置它们的缓存时间, e.g. 200 202 30m. See proxy_cache_valid for details. You may specify multiple, comma-separated values: 200 202 10m, 401 5m. defaults to 200 202 401 5m.

no-auth-locations

以逗号分隔的不应该通过身份验证的location列表。 default: "/.well-known/acme-challenge"

block-cidrs

以逗号分隔的IP地址(或子网)列表,必须全局阻止来自该IP地址(或子网)的请求。

References: http://nginx.org/en/docs/http/ngx_http_access_module.html#deny

block-user-agents

以逗号分隔的User-Agent列表,必须全局阻止来自该列表的请求。 在这里可以使用完整的字符串和正则表达式。 关于有效模式的更多详细信息可以在map Nginx指令文档中找到。

References: http://nginx.org/en/docs/http/ngx_http_map_module.html#map

block-referers

以逗号分隔的"引荐来源"列表,必须全局阻止来自其的请求。 在这里可以使用完整的字符串和正则表达式。 关于有效模式的更多详细信息可以在map Nginx指令文档中找到

References: http://nginx.org/en/docs/http/ngx_http_map_module.html#map

Last updated

Was this helpful?