Blocking URL Patterns in Firefox Network Monitor

This article provides a straightforward guide for developers on how to block specific URL patterns using the Network Monitor in the Firefox Web Browser. By intentionally failing network requests for scripts, stylesheets, API endpoints, or images, you can effectively test a web page's resilience, fallback mechanisms, and error-handling capabilities when specific assets fail to load.

1. Open the Firefox Network Monitor

First, navigate to the web page you want to test and open the Network Monitor using one of the following methods:

  • Press Ctrl + Shift + E (Windows/Linux) or Cmd + Option + E (macOS).
  • Right-click anywhere on the page, select Inspect, and click on the Network tab in the Developer Tools panel.

Reload the page if necessary to populate the network request list.

2. Block Specific URL Patterns

To block URLs based on wildcard patterns or partial strings before or after they load:

  1. Locate the left-hand sidebar within the Network panel. If it is closed, click the Request Blocking icon (a circle with a diagonal line through it) on the left vertical toolbar.
  2. Ensure the Enable Request Blocking checkbox at the top of this pane is checked.
  3. Click the + (Plus) button or the input field that says Block URL when it contains.
  4. Type the string or pattern you want to block and press Enter.

Firefox matches the text you enter as a substring against all outgoing network requests. You can also use the asterisk (*) wildcard for broader matching:

  • Specific file type: Enter .css or .woff2 to block all stylesheets or fonts.
  • Third-party domain: Enter analytics.example.com to block all requests to a specific external service.
  • API routes: Enter /api/v1/users to simulate a failed backend data fetch.
  • Wildcard matching: Enter https://example.com/*/*.png to block PNG images inside specific subdirectories.

3. Block an Individual Asset Directly

If you want to block a single, specific asset that has already loaded on the page without typing a pattern:

  1. Find the specific file or request in the main Network Monitor waterfall list.
  2. Right-click on the request row.
  3. Select Block URL from the context menu.

This automatically adds the exact URL of that asset to the Request Blocking pane on the left.

4. Test the Failed Asset Load

Once your patterns or URLs are added to the blocking list:

  1. Perform a hard reload of the page using Ctrl + Shift + R (Windows/Linux) or Cmd + Shift + R (macOS) to bypass the browser cache and force Firefox to re-request the assets.
  2. Observe the Transferred column in the Network Monitor. Any request matching your pattern will display Blocked in red text instead of the file size.
  3. Inspect your web page to verify that your application handles the missing assets gracefully (e.g., showing fallback fonts, displaying error messages for failed API calls, or rendering alt text for missing images).

5. Remove URL Blocks

Firefox remembers your blocked URL patterns across page reloads while the Developer Tools are open. To restore normal network behavior:

  • Disable temporarily: Uncheck the box next to an individual pattern, or uncheck Enable Request Blocking at the top of the blocking pane to disable all rules at once.
  • Delete permanently: Hover over a specific pattern in the blocking pane and click the X button, or right-click inside the blocking pane and select Remove All.