Closed leyvReyn closed 4 years ago
@rgs1 for any comments.
@leyvReyn the http local rate limiter is an HTTP filter, not a network filter (there an L4 filter too, but that's not what we are talking about here). So:
filter_chains:
- filters:
- name: envoy.filters.http.local_ratelimit
is wrong. You want it within the http filters, e.g.:
...
http_filters:
- name: envoy.filters.http.local_ratelimit
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
stat_prefix: http_local_rate_limiter
....
- name: envoy.filters.http.router
...
Awesome, thank you! The issue can be closed. This configuration worked well:
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 8090
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
stat_prefix: ingress_http
http_filters:
- name: envoy.filters.http.local_ratelimit
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
stat_prefix: http_local_rate_limiter
token_bucket:
max_tokens: 3
tokens_per_fill: 1
fill_interval: 1s
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
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match:
prefix: /stub1
route:
cluster: stub_cluster1
regex_rewrite:
pattern:
regex: ^/stub1[/]*(.*)$
google_re2: {}
substitution: /\1
- match:
prefix: /stub2
route:
cluster: stub_cluster2
regex_rewrite:
pattern:
regex: ^/stub2[/]*(.*)$
google_re2: {}
substitution: /\1
clusters:
- name: stub_cluster1
connect_timeout: 0.25s
type: STRICT_DNS
load_assignment:
cluster_name: stub_cluster1
endpoints:
- lb_endpoints:
- endpoint: {address: {socket_address: {address: stub1 , port_value: 8080}}}
- name: stub_cluster2
connect_timeout: 0.25s
type: STRICT_DNS
load_assignment:
cluster_name: stub_cluster2
endpoints:
- lb_endpoints:
- endpoint: {address: {socket_address: {address: stub2 , port_value: 8081}}}
but i ger error log
[2021-04-06 08:46:40.764][1][warning][config] [source/common/config/filesystem_subscription_impl.cc:65] Filesystem config update failure: Unable to parse JSON as proto (INVALID_ARGUMENT:(http_filters[0].typed_config): invalid value Invalid type URL, unknown type: envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit for type Any): {"resources":[{"filter_chains":[{"filters":[{"typed_config":{"route_config":{"name":"nginx","virtual_hosts":[{"routes":[{"route":{"cluster":"nginx"},"match":{"prefix":"/"}}],"domains":["*"],"name":"nginx"}]},"codec_type":"AUTO","http_protocol_options":{"header_key_format":{"proper_case_words":{}}},"stat_prefix":"nginx","@type":"type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager","access_log":[{"typed_config":{"@type":"type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog","path":"/dev/stdout"},"name":"access-log"}],"http_filters":[{"typed_config":{"stat_prefix":"http_local_rate_limiter","token_bucket":{"max_tokens":3,"tokens_per_fill":1,"fill_interval":"1s"},"@type":"type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit"},"name":"envoy.filters.http.local_ratelimit"},{"name":"envoy.filters.http.router","typed_config":{"@type":"type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"}}]},"name":"envoy.filters.network.http_connection_manager"}]}],"address":{"socket_address":{"address":"0.0.0.0","port_value":10000}},"@type":"type.googleapis.com/envoy.config.listener.v3.Listener","name":"listener_http_v4"}],"version_info":"1"}
Good day.
Trying to follow guide for HTTP local rate limit on documentation page
But getting error on envoy start:
Envoy version: docker container envoyproxy/envoy-alpine:v1.16.0
I guess the problem might be because well known names missing
envoy.filters.http.local_ratelimit
Possibly related pull request
Full config:
Full log: