I need to change request domain, but keep params on the same, can Requestly extension do it?

For Example

www.domain1.com?a=1&b=2 --> www.domain2.com?a=1&b=2

PS - The question was asked in our customer support chat. I posted it here since it is applicable in general and will help future readers.


Yes, This is very much possible using Requestly Replace Rule. Here's the steps to setup Replace Rule

  1. Create New Rule
  2. Select Replace Rule (Blue Color)
  3. Replace www.domain1.com With www.domain2.com
  4. Save Rule

Here's the screenshot of the rule

enter image description here

We have documentation on Replace Rule as well. Check this out. Here's an excerpt from the doc

Switch Domains

Situation: Suppose you are working on a web app which fetches content from your REST API available at http://my-app-server.com/rules. You have cloned the API server, made some changes and running it locally on http://localhost:4000/rules. Now, you want to test your app with the new changes done on API server.

Approach1: Change the domain in your App code to hit localhost instead of my-app-server. Once your testing is done revert this change.

Approach2: Use Replace Rule Define a Replace Rule to replace http://my-app-server.comwith http://localhost:4000 in all URLs. No need to change url inside your code. After your testing, just disable the rule.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.