How to use Block list in Charles Proxy

Introduction

During local development you might want to block access to external APIs to simulate an offline environment . It further complicates the process when you want to avoid unintended calls to production services to prevent additional billing.

“Block List” comes handy in such cases where you can block network responses from your backend without making any changes to your codebase.

    Setting up Block List in Charles Proxy is little complex. You can follow the steps below to configure Block List with ease.

    Browser Extension, that just needs you to fill 1 fields and doesn’t have VPN issues, is also explained later in this post. You can also use that in place of Charles Proxy.

    Charles Proxy’s Block List Tool: How It Works

    The Block List feature in Charles Proxy allows you to block specific network requests, preventing them from reaching the server. This can be useful for testing how your application behaves when certain resources (like APIs or scripts) are unavailable.

    How to Configure Charles Proxy’s Block List Tool

    1. Open Charles Proxy and ensure that your proxy is enabled and traffic is being captured.
    2. Navigate to the Tools Menu:
      • In the top menu, click on Tools.
      • From the dropdown, select Block List.

    Block List in menu
    1. This will open the Block List settings window Here check Enable Block List box and select Blocking action.

      • Drop Connection – this option will simulate a network error for the request
      • Return 403 – This option will return a 403 (forbidden) status code as response

    Block List Settings

    1. Now click on add to add a new url:

      • Protocol: Here you can select your site’s protocol http or https
      • Host: Here you can enter the host/domain that you want to apply the rule to.
      • Port: You can specify the port on which your site is running.
      • Path: Define the path if you want the rule to apply only to specific paths on the host.
      • Query: here you can define the query parameters which should be targeted.
    Block List location selector
    1. Now Save the rule by clicking OK.

    Block List settings
    1. After saving this you should be able to see the rule and its modifications

    2. Now visit the site you selected and you can see the URL change.

    I hope you are able to configure Block list tool, if you are facing issues in setup of SSL read about SSL setup on Charles Proxy official documentation.

    Due to this complicated setup process of Charles Proxy and issues with VPN we, at Requestly, came up with a smart solution. We developed a Browser Extension that can sit inside the browser and use browser’s APIs to intercept and modify your network requests and respones.

    Cancel request rule in Requestly

    Requestly is designed differently so it doesn’t need any SSL configuration and hence works seamlessly with your VPNsBlock List is simplified as “Cancel Request Rule” in Requestly. With just 1 inputs i.e. source URL matching condition, you can block any network response to your desired value.

    There are more advanced rules in Requestly & other features to help you test the working of the rule along with details of how to use this rule are explained below.

    Overview of Configuration Options
    • Source Condition: Here you specify the url pattern for which the request should be blocked.
    • Test URL Condition: You can check if the rules you’ve set up work correctly by testing them on specific URLs.

    Steps to Configure Requestly’s Cancel Request Rule

    1. Install Requestly Extension: Download and install Requestly’s browser extension.
    2. Open Requestly Dashboard: Visit app.requestly.io and log in.
    3. Click on the Rules tab and then select New Rule.
    4. Choose Cancel Rule as the rule type.
    5. Enter the URL pattern in the Source Condition field.
    6. Name your rule and click Save.

    Now you can test the rule on your desired website, or if you do not want to go through the hassle of setting it up yourself, we have created a shared list of this rule for disabling cache for you. Go ahead and import it by clicking this button below

    Or create your own Rule by following the setups below

    Interactive guide

    Check out this interactive and easy explanation of how to create this rule :

    Other Use Cases for Requestly’s Cancel request Rule

    Here are some key use cases for the Block Request rule in Requestly:

    • Security Testing: Block outgoing requests to simulate how your application behaves when certain endpoints are unreachable, helping to test error handling and fallback mechanisms.
    • Dependency Isolation: Block requests to third-party services to test how your application functions when external dependencies are unavailable.

    Migrate from Charles proxy

    If you already have a Charles Proxy setup and want to give Requestly a try, You can import these tool settings in Requestly in just few clicks Requestly currently supports following tools that you can import from Charles Proxy:
    • Rewrite
    • Map Local
    • Map Remote
    • No Caching
    • Block lists
    • Block Cookies

    Steps to import

    1. In Charles Proxy, go to the top menu bar and select Tools > Import/Export Settings.
    Charles proxy menu Import Export settings
    1. In the popup window that appears, switch to the Export tab. Under the Tools section, select the tools you want to export and click the Export button at the bottom right.

    Import Export Setting popup
    1. Open the Requestly dashboard. If you don’t have any existing rules, you’ll see an Import settings from Charles Proxy .
    Import from Charles proxy in requeslty dashboard
    1. Upload or drag your exported Charles .xml file into Requestly.

    Import charles proxy settings poip up
    1. Once the import is successful, your Charles Proxy settings will be converted into Requestly rules.

    Conclusion

    I hope you have got a clear understanding of both the Block List tool in Charles Proxy and how Requestly can achieve the same results with greater ease. While Charles Proxy effectively handles the task, Requestly offers a modern, simple and efficient experience.

    Since Requestly operates directly from your browser and leverages built-in browser APIs, there’s no need for complex SSL configurations, eliminating the VPN issues often encountered with Charles Proxy. Plus, you don’t need to switch between different tools — everything you need is right in your browser.

    Love for Requestly is reflected in its 4.4 ⭐ rating from over 1,200 users on the Chrome Web Store. Requestly is being used by 200K+ developers across the world.

    Happy Debugging!!!

    Explore More

    Share this article:

    Subscribe to our weekly newsletter !

    Join 10k developers and QAs to get weekly updates with Requestly's newsletter.​

    This article was written by:

    Picture of Dinesh Thakur

    Dinesh Thakur

    Dinesh Thakur, fascinated by technology since childhood, has mastered programming through dedication. Whether working solo or in a team, he thrives on challenges, crafting innovative solutions.

    Join 10k developers and get weekly updates with Requestly's newsletter.

    Contents