mefellows / muxy

Chaos engineering tool for simulating real-world distributed system failures
MIT License
823 stars 31 forks source link

Add ability to match based on paths regex in HTTP Proxy #11

Closed mefellows closed 7 years ago

mefellows commented 7 years ago

It would be great to be able to differentiate symptoms in the HTTP proxy and symptoms based on the incoming path. Middleware components should skip if the path does not match the incoming request.

This should allow some extra flexibility when proxying multiple endpoints on a single target (e.g. an Nginx server or API gateway).

Requirements:

HTTP Proxy

  1. Specify zero or more Proxy Rules on the http_proxy symptom. The rules may include the following details:
    1. Matching path, host and method as a regular expression
    2. Specifying proxy target rules (path, host and method as strings)
      1. All options replace existing request details, except for path which is prepended to the existing request path e.g. if path was /baz and request http://foo.com/foo/bar => http://foo.com/baz/foo/bar
  2. If no Proxy Rules are provided, default is to proxy as per current behaviour (all requests to proxy are sent to proxy target)
  3. If one or more Proxy Rules are specified, they will take precedence over a default catch-all proxy (existing behaviour)
  4. Proxy Rules are evaluated in the order they are specified (precedence)
  5. Performance is not a consideration

HTTP Symptom

  1. Specify zero or more Matching Rules on the http_tamperer and http_delay symptoms. The rules may include the following details:
    1. Matching path, host and method as a regular expression
  2. If no Matching Rules are provided, default is to apply symptoms as per current behaviour (all requests to proxy are mucked)
  3. If one or more Matching Rules are specified, unmatched rules do not have any symptom applied
  4. Proxy Rule precedence is FIFO