forked from istio/istio.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zh-translation: /faq/mixer/header-rules.md istio#1415
- Loading branch information
Showing
1 changed file
with
7 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
--- | ||
title: Why does my rule not match? | ||
title: 为什么我的规则无法匹配? | ||
weight: 50 | ||
--- | ||
|
||
Mixer rules must be valid to be applied at runtime. That means the match | ||
conditions are well-defined expressions in the | ||
[language](/zh/docs/reference/config/policy-and-telemetry/expression-language/), the attributes | ||
are declared in an [attribute | ||
manifest](/zh/docs/reference/config/policy-and-telemetry/attribute-vocabulary/), and rules have | ||
no dangling references to handlers and instances. | ||
Mixer 的规则必须在运行时验证。这意味着匹配条件的必须是 [语言](/zh/docs/reference/config/policy-and-telemetry/expression-language/) 中明确定义的表达式, | ||
属性是 [属性清单](/zh/docs/reference/config/policy-and-telemetry/attribute-vocabulary/) 中声明过的, | ||
并且规则所指向的 handler 和 instance 也必须存在。 | ||
|
||
The attribute values are typically normalized before evaluating rules on | ||
them. For example, HTTP headers have lowercase keys in `request.headers` and | ||
`response.headers` attributes. An expression | ||
`request.headers["X-Forwarded-Proto"] == "http"` does not match any request | ||
even though HTTP headers are case-insensitive. Instead, use an expression | ||
`request.headers["x-forwarded-proto"] == "http"`. | ||
在执行规则之前,属性值通常会被标准化。比如,在 `request.headers` 和 `response.headers` 属性中,HTTP 头的键是小写的。 | ||
表达式 `request.headers["X-Forwarded-Proto"] == "http"` 不会匹配任何请求,即使 HTTP 头部是不区分大小写的。 | ||
相反,应该使用这样的表达式 `request.headers["x-forwarded-proto"] == "http"`。 |