Redirect Rule

Navigate Your Web Traffic

4.8 ⭐ 1100+ Ratings, 200,000+ users

Trusted by 200k+ developers at →

Your Development Companion

Set up redirect rules effortlessly to manage URL changes, improving your testing process and streamlining development.

1. Supports APIs triggered as XHR or fetch

Gain control over API responses triggered by XHR/Fetch requests. As a result, you can effortlessly switch between development, staging, and production environments without touching your codebase, streamlining your development workflow.

2. Redirect Real API calls to Mock Server

Redirect real API requests to mock environments for testing and development. This allows you to simulate different scenarios and fine-tune your application’s performance before it goes live.

3. Load Local JS on Production

Enhance your debugging and testing processes by loading local JavaScript files directly onto your production environment.

4. Match URLs using Regex

Use regular expressions to achieve intricate URL pattern matching without the need for overly complex, indirect approaches. This grants you granular control over your URL replacements in a more streamlined manner.

5. Collaboration & 1-Click Sharing

Promote consistency and accelerate development by sharing Requestly rules within your team. Choose between shared workspaces for real-time collaboration or targeted sharing with individual members.

6. GraphQL Support

Test Staging GraphQL APIs with Production frontend, making sure all the operations are working properly, ensuring a seamless user experience post-deployment.


Trusted by 200k+ developers at →

More HTTP Request & Response Manipulation Rules

These HTTP Rules designed for all your local development and testing needs.

Replace String

Replace part of URL like hostname, query values.

Modify Headers

Modify HTTP request & response headers.

Query Params

Add or Remove Query Parameters

Insert Script

Inject Custom JS & CSS on any website(s).

Delay Network

Simulate delay in response of API calls.

Modify Request Body

Modify body of POST requests.

Requestly Highlights

A comprehensive debugging suite with thoughtfully designed features for front-end developers.

For the developers, by the developers ❤️

From Debug to Deploy: Developers Trust Requestly

Requestly comes as a savior whenever the Adobe platform debugger shows a glitch in the launch library override. I used Requestly for redirect and mockup file server and it really helped me in dev and debugging. The interface is easy to use and creating a rule on one machine and accessing it from different machines makes it awesome.

Pradeep Jaiswal
Technical Lead Consultant ShyftLabs

Just loved the way Requestly saved several person hours for our dev team by allowing us to redirect and intercept requests. The simple yet efficient rules allowed us to seamlessly redirect requests from a single staging front-end server to local backend servers. This meant that our devs didn’t need to build or run the front-end server locally when focusing on backend tasks.

Srijan Bhatnagar
Senior Software Engineer at Atlassian

Requestly is awesome. I used to use Charles proxy in my day-to-day work but it always messed with my wifi. I haven’t had any issues with Requestly. Requestly’s UI is an amazing tool and great to work in.

Carl Hand
Senior Software Engineer at Workday

Requestly not just made it easier for us to develop, test & debug our code on our customer sites but also helped us do engaging product demos to our prospective clients.

Michael Levinson
Co-Founder & CPO at Joyned

I’m a big fan of Requestly, and use it on a daily basis as a QA Engineer. It removes the need to use Charles Proxy often, which is always nice. I can just use Requestly directly in Chrome

Mike Mitchell
QA Engineer at URBN

Awesome tool. I use it almost daily for my projects to modify request body, headers, etc. Would recommend it to every frontend developer out there. Thank me later 🙂 (Case Study)

Harsh Vats
Frontend Engineer at PingSafe

This is by far the best tool for managing request headers! Plus the developers are very active meaning you’ll get help if you’re ever stuck or need help solving a problem. I use it daily and couldn’t be happier.

Jose Browne
Senior Engineer at Reddit

App works as expected! Ran into some small issues while creating the rules but the support team was able to help and overcome those.

José Miguel Dias Fernandes
Development Lead at Vodafone

Requestly is user-friendly, brilliant and easy-to-use. I use it on an daily basis and it makes my work easier. After using other tools like Charles – Requestly is a nice new breath of air that I highly vouch for. Apart from the tool being amazing – the support from the Requestly team is phenomenal with them always going above and beyond for their clients.

Marius Ludick
Solutions Architect II at Amazon

Requestly is an amazing tool to get your development work less hassle. The product itself has evolved so much since day-1 and the company is really serious on helping their customer solves their problems. We had this nice session where they shared Requestly features and we were very impressed on its potential. A truly 5-star worthy.

Natchapol Thongruang
Senior Software Engineer at Agoda

Great tool for frontend developers and QA tester for API response, redirects, mock data and much more. Requestly removes the dependency on waiting for backend API’s. Really useful to have in your frontend development environment.

Samroon Michael
Senior Frontend Developer at Mudah.my

Love using Requestly to swap versions of Adobe Launch from Prod to Staging and Dev. And also blocking various martech scripts to analyze their impacts on CWV(Core Web Vitals).

Arthur Engelhard
Senior Digital Implementation Manager at Newfold Digital

Introduction

The Redirect Rule in Requestly enables users to re-route web requests from one URL to another. This functionality is particularly valuable for developers and testers who need to manipulate network traffic for debugging, testing, or development purposes.

Content Overview

Video Guide

Step-by-Step Guide

To fully utilize the feature, let’s walk through the setup process:

  1. Start by installing Requestly extension in your browser.
  2. Go to HTTP Rules panel from the left side menu of the Requestly app.
  3. Select the ‘Redirect rule’ from the list of rules to open a detailed screen with more info about the Redirect rule. Click Create Rule button on the top right
  4. Enter the source condition to match the url using one of the built-in function from Equals, Contains, RegEx or Wildcard
  5. Optionally you can test your source condition using the Test URL condition button.
    • To test enter the url you want to check
    • You will be able to see if the url is matching and will get variables you can use for redirection
  6. Now Select the type of redirection you want
    • Redirect to another URL
    • Map Local (Desktop app only)
    • Redirect to Mock server (upload file)
  7. Based on the type of redirection enter the file/URL you want to redirect the request to.
  8. Use the Test this rule window that appears after saving the rule to validate its functionality.

Options

  1. Source Condition: If the request URL matches this source condition, then only the rule is applied. You can use URLHost, or Path with RegexContainsWildcard or Equals to match the source request. Learn more about source conditions here.
  2. Source Filters: This helps you define better targeting conditions and restrict rules to be applied on specific webpages (or domains), request types, request methods, or request payloads. Learn more about source filters here.
  3. Types of Redirects :
    1. URL Redirect : In this you mode you can enter the url where the matched request should be redirected to
    2. Map Local : In this mode you can redirect the request to any local file (works only in desktop app)
    3. Mock Server : In this mode you can use or add any file from your mock server on requestly
  4. Test this rule – This box will appear only after you save the rule, it accepts a URL and opens it in a new tab for you to test. It comes with an option to capture screen, console & network details, if enabled Requestly will capture these details in SessionBook for debugging later.

Use Cases

Redirect to local server:

In Requestly, you can create a Redirect Rule to direct requests to a specific local development server by specifying the original URL as the pattern and the local server URL as the redirect destination. This allows you to test changes locally without impacting the live production environment. Additionally, you can map production scripts or APIs to your local running code, enabling direct testing of local code on production sites without the need for deployment. Here are the steps you can follow for the same:

  1. Create a new Redirect Rule.
  2. Use your API hostname & path as source conditions like – company.com/api/path
  3. In Redirect URL field enter your local development URL like – localhost:8000.
  4. Save the Rule & Test.

Serving Local JSON as Sample Data for Development

Use Requestly to redirect API requests to locally stored JSON files, providing realistic sample data for front-end development and testing without relying on external servers. Here are the steps you can follow for the same:

  1. Create a new Redirect Rule.
  2. Use your API hostname & path as source conditions like – company.com/api/path
  3. in redirect select Mock Server and upload your json file
  4. Save the Rule & Test.

Test API version changes

Suppose there is a new version of some API which you are using. To test the backward compatibility of the API, you can just set up a redirect rule to redirect all URLs from the older version to the newer version and check if your application behaves as expected. This way, you don’t need to change a single line of your code and test the API upgrades.

  1. Create a new Redirect Rule
  2. Use your API hostname and path with wildcards in source conditions like – *://company.com/api/v0/*
  3. Enter the wildcard pattern to redirect the request keeping query parameters and url paths like – $1://company.com/api/v1/$2
  4. Save the Rule & Test.

Swap Tag Manager scripts from production to staging / dev environment

Using a Redirect Rule in Requestly, you can load unminified implementations from libraries like Bootstrap and jQuery for testing purposes this allows you to seamlessly switch between minified and unminified versions as needed during development, ensuring smoother troubleshooting and optimization of your web applications.

  1. Create a new Redirect Rule
  2. Enter the URL of minified version of your libraries in source condition for eg https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css
  3. Now redirect it to unminified version of the file eg – https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.css
  4. Save the Rule & Test.

Troubleshooting

There are some cases where rules might not work as expected, visit our troubleshooting guide for more details.