The Rewrite tool enables you to create rules that modify requests and responses as they pass through Charles. Rules such as adding or changing a header or search and replace some text in the response body.
Rewrite sets can be individual activated and deactivated. Each set contains a list of locations and rules. The locations choose the requests and responses on which the rules will operate.
Each rule describes a single rewrite operation. The rule may affect the headers, the body, or parts of the request URL; it may operate on the request and or the response; it may then define search and replace or just replace style rewriting.
More documentation for the rewrite rules is available in the Rewrite Rule editing dialog.
@@tools.gen.locations.locationMatching@@The Rewrite tool can be difficult to debug when your rewrite operation isn't working as expected. If you have trouble try including a very basic rule such as one that adds an obvious header, so you can see whether your rules are matching the request at all. Also turn on Debug in Error Log to get some debugging information printed in the Error Log accessed from the Window menu in Charles.