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"
Loading¶
Added in version 0.8.
The rules application is loaded by default when using the harp-proxy start or harp-proxy server command.
It can be disabled by passing the --disable rules option to the command.
harp-proxy start --disable rules ...