replace-xhr-request

Description

Intercepts and modifies outgoing XHR request bodies before they reach the server. This is useful for suppressing tracking data or tricking ad servers into thinking an ad has already been served.

Parameters

Name

Description

Mandatory

search

String or regex to match in the request body. Use jsonpath( prefix for targeted JSON property replacement.

yes

replacement

Value to replace the match with. In JSONPath mode, parsed via JSON.parse (e.g. "false" becomes false). Default: "".

no

needle

Optional regex to pre-filter requests — replacement only runs if this matches the body. Default: none.

no

mode

JSONPath operation mode: "replace" (default) overwrites the property; "append" merges or concatenates based on data type.

no

Filter Examples

Filter

Result

replace-xhr-request /trackingId/ blocked

Replaces every trackingId occurrence with blocked in all XHR request bodies.

replace-xhr-request /trackingId/ "blocked" "analytics"

Replaces trackingId only if the request body also contains "analytics".

replace-xhr-request "jsonpath($.ads.enabled)" "false"

Sets the enabled property inside ads to boolean false in the parsed JSON body.

replace-xhr-request "jsonpath($.tags)" '"blocked"' '' 'append'

Appends "blocked" into the tags array using JSONPath append mode.