afterpatch

AfterPatch Released as the First Aftermarket Tool

AfterPatch 0.1.0 is out. It’s the first working tool in the Aftermarket family: a small reverse proxy that repairs HTTP traffic between a client and a service, with rules you can read, and without changing either side.

You put it in front of a service, point the client at it, and give it a YAML file of rules. A rule says which traffic it applies to (method, path, query, headers, status, content type) and what to change: set or remove headers, rewrite the path, or rename, copy, set and delete JSON fields in the request or the response.

Here’s the case it was built around. An old client calls GET /api/v1/customer?id=7. The service it relied on was replaced by one that answers GET /api/v2/customers/7, with the customer nested and the fields renamed. Two rules make them talk again. The quick start walks through it in five minutes.

What comes with it

  • aftermarket patch run is the proxy itself.
  • --dry-run passes everything through untouched and logs what each rule would have changed. Try new rules on real traffic this way first.
  • The audit log gets one JSON line per change. It names the rule, the request and what changed, never the values, so secrets stay out of it.
  • aftermarket patch check validates a rule file and points out rules that overlap.
  • aftermarket patch test runs saved requests and responses through your rules, so a repair can live in CI like any other test.

It’s one binary for Linux, macOS and Windows, with no dependencies at all. Even the YAML reader is built in. Get it from the download page.

The promise it’s tested against

A repair should change one thing and break nothing else. Traffic no rule matches goes through byte for byte, without being buffered. A body that can’t be changed safely is passed on as it is and logged. That covers broken JSON, bodies that are too big and compression it doesn’t handle. A dead upstream gets a clean 502 and a slow one a 504. How AfterPatch was tested has the details and the numbers.

What’s next

0.2.0 adds aftermarket adapt for bigger API translations. After that come aftermarket record and replay, to capture real traffic and compare two versions of a service. The roadmap has the order.

Found something it should fix? Open an issue or write to [email protected].