APIG Ingress supports core and common Nginx Ingress annotations. This enables a seamless migration from Nginx Ingress to an APIG Ingress gateway. APIG Ingress also introduces additional annotations to provide traffic governance capabilities that Nginx Ingress annotations do not support. This topic describes the annotations that APIG Ingress currently supports.
Annotation feature overview
Standard Kubernetes Ingress provides only basic routing for Layer 7 HTTP traffic and TLS encryption. Ingress controllers typically use annotations to enhance the traffic governance and security protection capabilities of an Ingress.
Ingress annotation support status
Nginx Ingress annotations
To help Nginx Ingress users seamlessly migrate to APIG Ingress, APIG Ingress provides extensive support for Nginx Ingress annotations. The following table describes the support status.
Nginx Ingress annotation | Total supported | Notes |
Supported annotations | 51 | Covers 90% of user scenarios. |
Annotations that do not affect features | 15 | No configuration required. |
Temporarily unsupported annotations | 48 | Support is in progress. These are used in few scenarios. |
Unsupported annotations | 5 | Mainly involves Nginx-specific code snippets. |
Higress and Nginx have different implementations, which results in some differences.
Configurations that use NGINX variables and code snippets in Nginx Ingress annotations are not compatible.
Nginx Ingress uses the
nginx.ingress.kubernetes.io/proxy-body-sizeannotation to configure the size limit of a client request body. If a request body exceeds the specified size, Nginx returns an error. The Higress cloud-native gateway uses chunked streaming and does not require you to specify the request body size in advance. For large file transfers, you can adjust the `DownstreamConnectionBufferLimits` parameter in the parameter settings of the gateway instance.
APIG Ingress annotations
APIG Ingress introduces additional annotations to provide administration capabilities that are not available in Nginx Ingress annotations. The following table describes the current support status.
APIG Ingress annotation | Total supported | Notes |
Extended annotations | 40 | Enhances traffic governance and security protection features beyond Nginx. |
Scope definitions
Ingress: An Ingress-scoped annotation applies only to the routing rules that are defined in the current Ingress.
Domain name: A domain-scoped annotation applies to the hosts that are specified in the current Ingress. This scope also affects other Ingresses where the same host is specified.
Service: A service-scoped annotation applies to the services that are specified in the current Ingress. This scope also affects other Ingresses where the same service is specified.
Annotation prefixes
APIG Ingress supports all Nginx Ingress annotations. For example, nginx.ingress.kubernetes.io/xxx has the same effect as higress.ingress.kubernetes.io/xxx. You can use either the nginx or higress prefix. However, you cannot use the nginx prefix for annotations that are unique to APIG Ingress.
Annotation support summary
This topic covers two main modules: traffic governance and security protection.
Traffic governance
Canary release
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/canary | Ingress | Compatible | Enables or disables a canary release. |
nginx.ingress.kubernetes.io/canary-by-header | Ingress | Compatible | Splits traffic based on a |
nginx.ingress.kubernetes.io/canary-by-header-value | Ingress | Compatible | Splits traffic based on a |
nginx.ingress.kubernetes.io/canary-by-header-pattern | Ingress | Compatible | Splits traffic based on a |
higress.ingress.kubernetes.io/canary-by-query | Ingress | Higress extension | Splits traffic based on a |
higress.ingress.kubernetes.io/canary-by-query-value | Ingress | Higress extension | Splits traffic based on a |
higress.ingress.kubernetes.io/canary-by-query-pattern | Ingress | Higress extension | Splits traffic based on a |
nginx.ingress.kubernetes.io/canary-by-cookie | Ingress | Compatible | Splits traffic based on a |
higress.ingress.kubernetes.io/canary-by-cookie-value | Ingress |
| Splits traffic based on a |
nginx.ingress.kubernetes.io/canary-weight | Ingress | Compatible | Splits traffic based on weight. |
nginx.ingress.kubernetes.io/canary-weight-total | Ingress | Compatible | The sum of the weights. |
Multiple services
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/destination | Ingress | Higress extension | Configures weight-based service distribution for a route. The syntax is Note
|
Syntax example:
annotations:
# 60% of traffic is routed to the foo service, and 40% is routed to the bar service.
higress.ingress.kubernetes.io/destination: |
60% foo.default.svc.cluster.local:8080
40% bar.default.svc.cluster.local:9090Service subset
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/service-subset | Ingress |
| Applies to scenarios where one service manages multiple deployments. Specifies that the route defined by the Ingress is forwarded to a subset of the pods under this service.
Note If the service does not have a pod with the specified label, traffic is automatically routed to all pods under the service for disaster recovery. |
higress.ingress.kubernetes.io/subset-labels | Ingress |
| Optional. This annotation works with |
Fallback (disaster recovery)
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/default-backend | Ingress | Compatible | The disaster recovery service. When the service defined in the Ingress has no active nodes, requests are automatically forwarded to this disaster recovery service. |
nginx.ingress.kubernetes.io/custom-http-errors | Ingress | Compatible | This annotation works with Important When a request is forwarded to the disaster recovery service, the request path is rewritten to /, which is consistent with the behavior of |
Regex match
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/use-regex | Ingress | Compatible | Regex match. Indicates that the path defined in the Ingress is matched using a regular expression. The regular expression uses the RE2 syntax. |
Rewrite
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/rewrite-target | Ingress | Compatible | Rewrites the original path defined in the Ingress to a specified target. Supports |
nginx.ingress.kubernetes.io/upstream-vhost | Ingress | Compatible | When a request that matches the route defined in the Ingress is forwarded to the backend service, the Host header is changed to the specified value. |
Redirection
The feature sets of Nginx and Nginx Ingress are different. Nginx provides a broader range of features. The official Nginx Ingress documentation does not mention support for redirection that uses NGINX variables. Although some versions of Nginx Ingress may support the configuration of NGINX variables, using them can cause compatibility issues because this feature is not officially documented. We recommend that you do not use NGINX variables in Nginx Ingress.
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/ssl-redirect | Ingress | Compatible | Redirects HTTP to HTTPS. |
nginx.ingress.kubernetes.io/force-ssl-redirect | Ingress | Compatible | Redirects HTTP to HTTPS. |
nginx.ingress.kubernetes.io/permanent-redirect | Ingress | Compatible | Permanent redirect. |
nginx.ingress.kubernetes.io/permanent-redirect-code | Ingress | Compatible | The status code for a permanent redirect. |
nginx.ingress.kubernetes.io/temporal-redirect | Ingress | Compatible | Temporary redirect. |
nginx.ingress.kubernetes.io/app-root | Ingress | Compatible | Changes the application root path. Requests to / are redirected to the new path. |
Cross-domain
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/enable-cors | Ingress | Compatible | Enables or disables cross-domain access. |
nginx.ingress.kubernetes.io/cors-allow-origin | Ingress | Compatible | The allowed third-party sites. |
nginx.ingress.kubernetes.io/cors-allow-methods | Ingress | Compatible | The allowed request methods, such as GET, POST, and PUT. |
nginx.ingress.kubernetes.io/cors-allow-headers | Ingress | Compatible | The allowed request headers. |
nginx.ingress.kubernetes.io/cors-expose-headers | Ingress | Compatible | The allowed response headers that can be exposed to the browser. |
nginx.ingress.kubernetes.io/cors-allow-credentials | Ingress | Compatible | Specifies whether to allow credentials to be carried. |
nginx.ingress.kubernetes.io/cors-max-age | Ingress | Compatible | The maximum cache duration for preflight results. |
Header control
Header control annotations defined on a standard route do not apply to a canary route. The header control annotations defined on standard and canary routes are independent and take effect separately. This lets you set different header operation policies for standard and canary routes.
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/request-header-control-add | Ingress | Higress extension | Adds a specified header when a request is forwarded to the backend service. If the header exists, its value is appended to the original value. The syntax is as follows:
|
higress.ingress.kubernetes.io/request-header-control-update | Ingress | Higress extension | Changes a specified header when a request is forwarded to the backend service. If the header exists, its value overwrites the original value. The syntax is as follows:
|
higress.ingress.kubernetes.io/request-header-control-remove | Ingress | Higress extension | Deletes a specified header when a request is forwarded to the backend service. The syntax is as follows:
|
higress.ingress.kubernetes.io/response-header-control-add | Ingress | Higress extension | Adds a specified header before forwarding a response from the backend service to the client. If the header exists, its value is appended to the original value. The syntax is as follows:
|
higress.ingress.kubernetes.io/response-header-control-update | Ingress | Higress extension | Changes a specified header before forwarding a response from the backend service to the client. If the header exists, its value overwrites the original value. The syntax is as follows:
|
higress.ingress.kubernetes.io/response-header-control-remove | Ingress | Higress extension | Deletes a specified header before forwarding a response from the backend service to the client. The syntax is as follows:
|
Timeout
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/timeout | Ingress | Higress extension | The request timeout period in seconds. By default, no timeout period is configured. Note The timeout setting applies to the application layer, not the transport-layer TCP. |
Retry
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/proxy-next-upstream-tries | Ingress | Compatible | The maximum number of retries for a request. The default is 3. |
nginx.ingress.kubernetes.io/proxy-next-upstream-timeout | Ingress | Compatible | The timeout period for request retries in seconds. By default, no timeout period is configured. |
nginx.ingress.kubernetes.io/proxy-next-upstream | Ingress | Compatible | The conditions for retrying a request. For more information, see Nginx retry mechanism. |
Traffic mirroring
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/mirror-target-service | Ingress | Higress extension | Copies and forwards traffic to a specified mirror service. The service format is namespace/name:port.
|
higress.ingress.kubernetes.io/mirror-percentage | Ingress |
| The percentage of traffic to copy. The value can range from 0 to 100. The default is 100. |
Domain name alias
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/server-alias | Domain name |
| Defines an alias for the domain name that appears in the Ingress spec. The domain name alias shares the TLS, routing, and traffic governance configurations of the source domain name. |
Single-instance throttling (to be deprecated)
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/route-limit-rpm | Ingress | Higress extension | The maximum number of requests per minute for the route defined by this Ingress on each gateway instance. The maximum instantaneous number of requests is this value multiplied by When throttling is triggered, the response body is
|
higress.ingress.kubernetes.io/route-limit-rps | Ingress | Higress extension | The maximum number of requests per second for the route defined by this Ingress on each gateway instance. The maximum instantaneous number of requests is this value multiplied by When throttling is triggered, the response body is
|
higress.ingress.kubernetes.io/route-limit-burst-multiplier | Ingress | Higress extension | The factor for the maximum instantaneous number of requests. The default is 5. |
Global throttling (recommended)
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/rate-limit | Ingress |
| The global throttling for the route defined by this Ingress on the gateway instance, which is the maximum number of requests per second. |
higress.ingress.kubernetes.io/rate-limit-fallback-custom-response-code | Ingress |
| The response status code when throttling is triggered for the route defined by this Ingress. The default is 429. Note This annotation is mutually exclusive with rate-limit-fallback-redirect-url. You can choose either a custom response or a redirection. |
higress.ingress.kubernetes.io/rate-limit-fallback-custom-response-body-type | Ingress |
| The format of the response body when throttling is triggered for the route defined by this Ingress. The default is text.
|
higress.ingress.kubernetes.io/rate-limit-fallback-custom-response-body | Ingress |
| The response body when throttling is triggered for the route defined by this Ingress. The default is `sentinel rate limited`. |
higress.ingress.kubernetes.io/rate-limit-fallback-redirect-url | Ingress |
| The redirection address when throttling is triggered for the route defined by this Ingress. Note This annotation is mutually exclusive with rate-limit-fallback-custom-response-code. You can choose either a redirection or a custom response. |
Global concurrency control
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/concurrency-limit | Ingress |
| The global concurrency control for the route defined by this Ingress on the gateway instance, which is the maximum number of instantaneous requests being processed. |
higress.ingress.kubernetes.io/concurrency-limit-fallback-custom-response-code | Ingress |
| The response status code when concurrency control is triggered for the route defined by this Ingress. The default is 429. Note This annotation is mutually exclusive with concurrency-limit-fallback-redirect-url. You can choose either a custom response or a redirection. |
higress.ingress.kubernetes.io/concurrency-limit-fallback-custom-response-body-type | Ingress |
| The format of the response body when concurrency control is triggered for the route defined by this Ingress. The default is text.
|
higress.ingress.kubernetes.io/concurrency-limit-fallback-custom-response-body | Ingress |
| The response body when concurrency control is triggered for the route defined by this Ingress. The default is `sentinel rate limited`. |
higress.ingress.kubernetes.io/concurrency-limit-fallback-redirect-url | Ingress |
| The redirection address when concurrency control is triggered for the route defined by this Ingress. Note This annotation is mutually exclusive with concurrency-limit-fallback-custom-response-code. You can choose either a redirection or a custom response. |
Protocol used by the backend service
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/backend-protocol | Service | Partially compatible. AJP and FCGI are not supported. | Specifies the protocol used by the backend service. The default is HTTP. Supported values are:
|
Load balancing
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/load-balance | Service | Partially compatible. The | The standard load balancing algorithm for the backend service. The default is
|
nginx.ingress.kubernetes.io/upstream-hash-by | Service | Partially compatible. The combined use of NGINX variables and constants is not supported. | The consistent hashing load balancing algorithm. APIG Ingress supports the following forms:
|
Service prefetch (graceful start)
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/warmup | Service | Higress extension | The service ramp-up period in seconds. This is disabled by default. Important Service prefetch depends on the selected load balancing algorithm. Currently, only round_robin and least_conn are supported. |
Cookie affinity
Annotation | Function | Support level | Description |
nginx.ingress.kubernetes.io/affinity | Service | Compatible | The affinity type. Currently, only Cookie is supported. The default is |
nginx.ingress.kubernetes.io/affinity-mode | Service | Partially compatible. The | The affinity mode. APIG Ingress currently supports only the Balanced mode. The default is the |
nginx.ingress.kubernetes.io/session-cookie-name | Service | Compatible | Configures the value of a specified cookie as the hash key. |
nginx.ingress.kubernetes.io/session-cookie-path | Service | Compatible | The path value for the generated cookie when the specified cookie does not exist. The default is |
nginx.ingress.kubernetes.io/session-cookie-max-age | Service | Compatible | The time-to-live (TTL) of the generated cookie when the specified cookie does not exist. The unit is seconds. The default is session level. |
nginx.ingress.kubernetes.io/session-cookie-expires | Service | Compatible | The TTL of the generated cookie when the specified cookie does not exist. The unit is seconds. The default is session level. |
IP access control
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/whitelist-source-range | Ingress | Compatible | Specifies the IP address whitelist for the route. Supports IP addresses or Classless Inter-Domain Routing (CIDR) blocks, separated by commas (,). |
nginx.ingress.kubernetes.io/denylist-source-range | Ingress |
| Specifies the IP blacklist for the route. Supports IP addresses or CIDR blocks, separated by commas (,). Note This annotation has a higher priority than the Higress extension annotation higress.ingress.kubernetes.io/blacklist-source-range. |
higress.ingress.kubernetes.io/blacklist-source-range | Ingress | Higress extension | Specifies the IP blacklist for the route. Supports IP addresses or CIDR blocks, separated by commas (,). |
higress.ingress.kubernetes.io/domain-whitelist-source-range | Ingress | Higress extension | Specifies the IP address whitelist for the domain name. The domain name has a lower priority than the route level. Supports IP addresses or CIDR blocks, separated by commas (,). |
higress.ingress.kubernetes.io/domain-blacklist-source-range | Ingress | Higress extension | Specifies the IP blacklist for the domain name. The domain name has a lower priority than the route level. Supports IP addresses or CIDR blocks, separated by commas (,). |
Connection pool configuration between the gateway and backend services
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/connection-policy-tcp-max-connection | Service | Higress extension | The maximum number of connections that can be established between the gateway and the backend service. |
higress.ingress.kubernetes.io/connection-policy-tcp-max-connection-per-endpoint | Service | Higress extension | The maximum number of connections that can be established between the gateway and a single node of the backend service. |
higress.ingress.kubernetes.io/connection-policy-http-max-request-per-connection | Service | Higress extension | The maximum number of requests on a single connection between the gateway and the backend service. |
Security protection
Encrypted communication between client and gateway
Annotation | Scope | Support level | Description |
higress.ingress.kubernetes.io/tls-min-protocol-version | Domain name | Higress extension | Specifies the minimum TLS version. The default is TLSv1.0. Valid values are:
|
higress.ingress.kubernetes.io/tls-max-protocol-version | Domain name | Higress extension | Specifies the maximum TLS version. The default is TLSv1.3. Valid values are:
|
nginx.ingress.kubernetes.io/ssl-cipher | Domain name | Compatible | Specifies the TLS cipher suite. You can specify multiple cipher suites separated by colons (:). This takes effect only when TLSv1.0-1.2 is used for the TLS handshake. The default cipher suites are:
|
higress.ingress.kubernetes.io/auth-tls-secret | Domain name | Partially compatible. The secret name must be in the format: (name of the secret where the domain name certificate is located) | The CA certificate used by the gateway to verify the certificate provided by the client during an mTLS handshake. This annotation is mainly used in scenarios where the gateway needs to verify the client identity. |
Encrypted communication between gateway and backend service
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/proxy-ssl-secret | Service | Compatible | The client certificate used by the gateway for identity authentication by the backend service. |
nginx.ingress.kubernetes.io/proxy-ssl-name | Service | Compatible | The SNI used during the TLS handshake. |
nginx.ingress.kubernetes.io/proxy-ssl-server-name | Service | Compatible | Enables or disables the SNI used during the TLS handshake. |
Authentication
Basic
Annotation | Scope | Support level | Description |
nginx.ingress.kubernetes.io/auth-type | Ingress | Partially compatible. Only Basic is supported. | The authentication type. |
nginx.ingress.kubernetes.io/auth-secret | Ingress | Compatible | The secret name. The format |
nginx.ingress.kubernetes.io/auth-secret-type | Ingress | Compatible | The secret content format.
|
nginx.ingress.kubernetes.io/auth-realm | Ingress | Compatible | The protection domain. The same protection domain shares usernames and passwords. |
For more information about Nginx Ingress annotations, see the official documentation.