Getting Started

To get started with the rules engine, you need to write a configuration file that defines the rules you want to apply:

[rules."*"."*"]
on_request = """
request.headers["X-Forwarded-For"] = "Joe"
"""

[rules."httpbin-*"."GET /*"]
on_remote_response = """
response.headers["Cache-Control"] = "max-age=3600"
"""
rules:
  "*":
    "*":
      on_request: |
        request.headers["X-Forwarded-For"] = "Joe"
  "httpbin-*":
    "GET /*":
      on_remote_response: |
        response.headers["Cache-Control"] = "max-age=3600"

Then make sure that you enable the rules application, and load the configuration file you just wrote:

harp start --enable rules -f my-rules.toml
harp start --enable rules -f my-rules.yml