> For the complete documentation index, see [llms.txt](https://docs.stoobly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stoobly.com/core-concepts/agent/proxy-settings/rewrite-rules.md).

# Rewrite Rules

{% hint style="info" %}
**Configures:**

* How to modify parts of a request?
  {% endhint %}

Rewrite rules enable modification of any part of a request. Rules are applied if a request URL matches the provided regex **pattern.** If there are no rewrite rules or a request URL does not match any of the rule patterns, then there will be no modifications to the intercepted request.

## Rule Configuration

<figure><img src="/files/1O0DCb24qcGSrGswaloW" alt=""><figcaption><p>Figure 1. Rewrite rule</p></figcaption></figure>

### Method

HTTP verb(s) the rule applies to such as GET, POST, DELETE, etc.

### Pattern

Pattern to match with the request URL to apply the rule to. This supports regular expressions.

### Parameters

Which components of the request to match on, such as header, body, and query param.

### Name

Name of the component

e.g. for the header `Authorization: Token` , the name is `Authorization`

### Value

Value of the component

e.g. for the header `Authorization: Token` , the value is `Token`

### Modes Applied To

Which agent mode to apply the filter rule to such as mock, record and/or replay

## Example

For example, say you want to record requests to endpoints that require valid OAuth tokens. Let's say that endpoint is `GET https://internal.company.com/v1/users` . Then you can create a rewrite rule with the following values:

* Method - `GET`
* Pattern - `https://internal.company.com/v1/users`
* Parameter Type - `Header`
* Parameter Name - `Authorization`
* Value - `REDACTED TOKEN`
* Modes Applied To - `Record`

When recording, this will configure the agent to rewrite the `Authorization` header's value with `REDACTED TOKEN`. Similarly, when replaying a request, we can also create a rule set this same header with a valid token. For advance use cases, see:

{% content-ref url="/pages/L80ROjPjA3paJPSgdFzA" %}
[How to Customize Recordings](/guides/how-to-record-requests/how-to-customize-recordings.md)
{% endcontent-ref %}
