Introduction
Testing CMP configurations on a live server can result in unreliable outcomes and disruptions to the user experience. The complexity of live debugging makes it frustrating for developers to resolve issues effectively.
Requestly simplifies this by allowing you to load non-minified CMP scripts in production, enabling more reliable and controlled debugging.
Load non-minified version of CMP
The Redirect Rule
 in Requestly allows you to redirect requests to load the non-minified version of CMP scripts instead of the minified ones. This is particularly useful for debugging and optimizing scripts in a production environment without disrupting live operations.
- 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/cmp.min.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 the non-minified version of CMP scripts for debugging on production:
- Open Requestly:Â Launch the Requestly app.
- Create a New Rule:Â Click on
New Rule
and selectRedirect Rule.
- Enter the Minified CMP Script URL Pattern:Â Add the URL pattern for the minified CMP script you want to replace.
- Specify the Non-Minified CMP Script URL:Â Enter the URL of the non-minified version of the CMP script. This URL will be the target of the redirect.
- Example Minified URL:Â
https://example.com/cmp.min.js
- Example Non-Minified URL:Â
https://example.com/cmp.js
- Example Minified URL:Â
- Save the Rule:Â Click
Save
to create the rule.
Interactive Guide
Check this interactive and easy explanation of how to create Redirect rule.
Conclusion
Try this redirect rule to load the non-minified CMP scripts for easier debugging in production, ensuring accurate issue resolution without disrupting live operations. Requestly is trusted by over 200k developers and 1000+ corporates for its efficiency in managing network requests.
Explore More: