title: How can I set an envoy local rate limit, on all the paths starting with a given path?
body: <p>How can I set an envoy local rate limit, on all the paths starting with a given path?</p>
  <p>eg: I want to enforce the same rate limit on the URLs starting with : /swagger-ui/...</p>
  <p>I've tried a couple of things, including passing a regex in the path: ^/swagger-ui/.*$ but nothing seems to work.</p>
  <p>Thanks</p>
  <p>My envoy yaml file looks like this:</p>
  <pre><code>static_resources:
    listeners:
    - address:
        socket_address:
          address: 0.0.0.0
          port_value: 80
      filter_chains:
      - filters:
        - name: envoy.http_connection_manager
          typed_config:
            &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
            codec_type: AUTO
            stat_prefix: ingress_http
            http_filters:
            - name: envoy.filters.http.local_ratelimit
              typed_config:
                &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
                stat_prefix: http_local_rate_limiter
                local_rate_limit_per_downstream_connection: false
                filter_enabled:
                  runtime_key: test_enabled
                  default_value:
                    numerator: 100
                    denominator: HUNDRED
                filter_enforced:
                  runtime_key: test_enforced
                  default_value:
                    numerator: 100
                    denominator: HUNDRED
            - name: envoy.filters.http.router
              typed_config:
                &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
            route_config:
              name: local_route
              virtual_hosts:
              - name: backend
                domains: [&quot;*&quot;]
                routes:
                - match: { prefix: &quot;/&quot;}
                  route: 
                    cluster: middleware
                    timeout: { seconds: 120 }
                    rate_limits:
                    - actions: # any actions in here
                      - request_headers:
                          header_name: &quot;:path&quot;
                          descriptor_key: path
                  typed_per_filter_config:
                    envoy.filters.http.local_ratelimit:
                      &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
                      stat_prefix: test
                      token_bucket:
                        max_tokens: 300
                        tokens_per_fill: 1
                        fill_interval: 600s
                      filter_enabled:
                        runtime_key: test_enabled
                        default_value:
                          numerator: 100
                          denominator: HUNDRED
                      filter_enforced:
                        runtime_key: test_enforced
                        default_value:
                          numerator: 100
                          denominator: HUNDRED
                      descriptors:
                      - entries:
                        - key: path
                          value: /swagger-ui/
                        token_bucket:
                          max_tokens: 15
                          tokens_per_fill: 1
                          fill_interval: 600s
                      - entries:
                        - key: path
                          value: /user/create
                        token_bucket:
                          max_tokens: 3
                          tokens_per_fill: 1
                          fill_interval: 600s
  
    clusters:
    - name: middleware
      connect_timeout: 1s
      type: STRICT_DNS
      dns_lookup_family: V4_ONLY
      lb_policy: ROUND_ROBIN
      load_assignment:
        cluster_name: middleware
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: middleware
                      port_value: 8080
  admin:
    access_log_path: &quot;/dev/null&quot;
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 8001 
  </code></pre>