Skip to content

Request Rewrite

wanghongenpin edited this page Jan 8, 2024 · 1 revision

Request and response content can be modified by rewriting rules. Currently, rewriting supports 5 types, namely replace request, replace response, modify request, modify response, and redirect。

image

Create rules

You can enter the request rewrite menu and create a new rule in the request rewrite window. You can also quickly create a rewrite rule by clicking on the rewrite icon in the packet capture details message body.

image

Replace Response

This rewriting behavior represents the overall replacement of response data, supporting replacement parts: status code method, response header, and response body.

Modification request

Compared to the replacement request behavior, the modification request provides a more detailed modification strategy. For example, deleting query parameters and regularly replacing the content of the request body.

Give an example. We would like to modify the value of name to 345 with the following request parameters, but keep the other parameters unchanged.
https://example.com?name=123&age=32

image

If it's a bit more complicated, we don't know the specific value of the key, but we still want to replace it with 345. We can use a regular expression:

image

A request can create and apply multiple modification rules, which we can manage in a list.

image