Request Modification — Map Remote

Getting Started
Installation
Setup
Inspect Traffic
HTTP Rules (Modify Traffic)
Session Book
Mock Server
API Client
File Server
Workspace
Public API
FAQ
Guides
TroubleShooting
Subscription & Billing
Getting Started
Installation
Setup
Inspect Traffic
API Client
HTTP Rules (Modify Traffic)
Mock Server
File Server
Workspace
Public API
Sessions Replay
Guides
Session Book
Subscription & Billing
TroubleShooting
 

Map Remote

The Map Remote feature lets you change the request's location to a new destination location such that the response is transparently served from the new location as if it was the original request.

How to use

You can use Redirect/Replace rule to set up mappings.
  • Redirect rule allows you to redirect network requests from one URL to another.
  • Replace rule allows you to replace a part of the URL with another string.
You can check out the demo here:
Video preview

Matching Requests

All the Requestly rules can match requests based on the URL, host, path, and rule operators. With the help of these operators, you can define rules to match using the wildcard, regex, or string matching types. You can also perform advanced targeting on the requests.
You can perform regex pattern matching in replace rule to extract information from the URL:
For example: Extract domain, pathName and extension for URLs ending with .jpg
/(https:\/\/[^\/]*)(.+)(\.jpg)$/i
  • $1 is the value of 1st group expression. – DomainName
  • $2 is the value of the 2nd group expression – PathName but not the file extension
  • $3 is the value of the 3rd group expression – File extension .jpg in this case

Similar Examples

Map local resources on the production site

notion image
 
You can find the above redirect rule here.

Switch domain to staging environment using replace rule

notion image
You can find the above replace the rule here.

Popular Use Cases

  • Use development/staging endpoints on your production sites without changing the code so that you can directly test your local code on production sites without deployment.
  • You can switch your domain to a local environment for testing new changes that are yet to be deployed.
  • You can map HTTP requests to an HTTPS destination and vice versa.
  • You can test the backward compatibility of a new API by mapping all requests to the more recent version of the API.