Map Remote

Page Type
Meta Title
Meta Description
Category
HTTP Rules (Modify Traffic)
Publish
Publish
Path
/http-rules/map-remote
Β 

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.
Β