Introduction
Testing development versions of assets directly in production can be risky, potentially disrupting your live environment and affecting end-users. The challenge of validating new features or bug fixes without impacting users complicates the process.
Requestly simplifies this by allowing you to test development versions safely by redirecting network calls, ensuring a smooth validation process without disrupting your live site.
Load dev version of assets
The Redirect Rule
in Requestly lets you redirect requests to development versions of assets instead of the production ones. This is particularly useful for testing and validating changes in a controlled environment without impacting live users.
- Another URL:Â You can redirect the request to a different URL. In this case, the redirection is happening to a new JavaScript file URL.
- Local File:Â This option lets you redirect to a local file stored on your machine.
- From Files/Mock server: You can also choose to redirect the request to a file hosted on a mock server or from files you’ve set up.
- Source Condition:Â This determines which requests will be redirected. Here, any request containingÂ
https://example.com/production-asset.js
 will be redirected. - Destination URL: This is the URL where the request is redirected. In the example, it’s redirecting to a new debug script.
- Test URL Condition: You can check if the rules you’ve set up work correctly by testing them on specific URLs.
- Filter Out Condition:Â You can applyÂ
filters
 to limit which requests are affected, making sure only the ones you want are modified.
Or create your own Rule
by following the steps below
Here’s how to set up a redirect rule to load development versions of assets on production for testing:
- Open Requestly: Open the Requestly app.
- Create a New Rule: Click on
New Rule
and selectRedirect Rule.
- Enter the Production Asset URL Pattern: Add the URL pattern for the production assets you want to replace with development versions.
- Specify the Development Asset URL: Enter the URL of the development version of the asset. This URL will be the target of the redirect.
- Example Production URL:
https://example.com/production-asset.js
- Example Development URL:
https://example.com/dev-asset.js
- Example Production URL:
- Save the Rule: Click ‘Save’ to create the rule and ensure it is activated by toggling the switch to the ‘On’ position.
Interactive Guide
Check this interactive and easy explanation of how to create Redirect rule.
Conclusion
Try this redirect rule to load development versions of assets in production for testing, ensuring changes are verified without impacting live data. Requestly is trusted by over 200k developers and 1000+ corporates for its efficiency in managing network requests.
Explore More: