Skip to content

Commit

Permalink
zh-translation: /faq/mixer/header-rules.md istio#1415
Browse files Browse the repository at this point in the history
  • Loading branch information
3ks committed Dec 13, 2019
1 parent d4050ed commit 7945ef8
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions content/zh/faq/mixer/header-rules.md
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"`

0 comments on commit 7945ef8

Please sign in to comment.