Replace Strings (Switch Hosts, API Endpoints)


Replace Strings

Replace Rule allows users to replace a string (or matching pattern) with another string in the URL.
notion image
  1. Source Condition: Source condition is where you set criteria for the rules. You can use URL, Host, or Path with Regex, Contains, Wildcard, or Equals to match the source request. Learn more about source conditions here.
  1. Destination URL: The destination to which the users will be redirected based on the source condition.
  1. Source Filters: You can define better targeting conditions and restrict rules to be applied on specific web pages (or domains), request types, request methods, or request payloads. Learn more about source filters here.

Popular use cases

  • Switch Domains: To test your app with the new changes done on the local server, you can use replace with localhost:4000 using Replace Rule. By this way, you can test your app without having to change any of your code.
  • Change Query Parameter Values: You can change the values of query parameters present in a URL. For example: Changing ?dl-0 to ?dl=1 in a dropbox URL downloads the file directly without going to the usual preview page.
  • Fix broken/updated URLs: There might be situations where you might be using links to some documentation or blog posts that have been changed/updated, however, you don't want to change the URLs in your code. In such cases, you can use replace rule to redirect the old resource to new one.
Video preview