forked from envoyproxy/envoy
-
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.
- Loading branch information
Showing
2 changed files
with
125 additions
and
28 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
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 |
---|---|---|
@@ -0,0 +1,102 @@ | ||
static_resources: | ||
listeners: | ||
- name: main | ||
address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 8000 | ||
filter_chains: | ||
- filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
codec_type: AUTO | ||
stat_prefix: ingress_http | ||
route_config: | ||
name: local_route | ||
virtual_hosts: | ||
- name: httpbin | ||
domains: | ||
- "httpbin.org" | ||
routes: | ||
#curl -v -H "Host: httpbin.org" 127.0.0.1:8000/headers | ||
- match: | ||
prefix: "/headers" | ||
route: | ||
cluster: httpbin | ||
#curl -v -H "Host: httpbin.org" 127.0.0.1:8000/uuid | ||
- match: | ||
prefix: "/" | ||
route: | ||
cluster: httpbin | ||
|
||
# typed_per_filter_config 会覆盖 http_filters 下面的配置,但是实际的 filter 还要在 http_filters 配置一下,仅仅在 typed_per_filter_config 配置是不会创建 filter 对象的 | ||
typed_per_filter_config: | ||
envoy.filters.http.local_ratelimit: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit | ||
stat_prefix: http_local_rate_limiter | ||
token_bucket: | ||
max_tokens: 2 | ||
tokens_per_fill: 2 | ||
fill_interval: 10s | ||
filter_enabled: | ||
runtime_key: local_rate_limit_enabled | ||
default_value: | ||
numerator: 100 | ||
denominator: HUNDRED | ||
filter_enforced: | ||
runtime_key: local_rate_limit_enforced | ||
default_value: | ||
numerator: 100 | ||
denominator: HUNDRED | ||
response_headers_to_add: | ||
- append: false | ||
header: | ||
key: x-local-rate-limit-per-route | ||
value: 'true' | ||
|
||
http_filters: | ||
- name: envoy.filters.http.local_ratelimit | ||
# 下面的配置相当于是 filter 在此 listener 下面的全局配置 | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit | ||
stat_prefix: http_local_rate_limiter | ||
token_bucket: | ||
max_tokens: 5 | ||
tokens_per_fill: 3 | ||
fill_interval: 10s | ||
filter_enabled: | ||
runtime_key: local_rate_limit_enabled | ||
default_value: | ||
numerator: 100 | ||
denominator: HUNDRED | ||
filter_enforced: | ||
runtime_key: local_rate_limit_enforced | ||
default_value: | ||
numerator: 100 | ||
denominator: HUNDRED | ||
response_headers_to_add: | ||
- append: false | ||
header: | ||
key: x-local-rate-limit | ||
value: 'true' | ||
|
||
- name: envoy.filters.http.router | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
|
||
clusters: | ||
- name: httpbin | ||
connect_timeout: 5000s | ||
type: strict_dns | ||
dns_refresh_rate: 60s | ||
lb_policy: round_robin | ||
load_assignment: | ||
cluster_name: httpbin | ||
endpoints: | ||
- lb_endpoints: | ||
- endpoint: | ||
address: | ||
socket_address: | ||
address: httpbin.org | ||
port_value: 80 |