# Mocking Traffic

A typical scenario is when a client, a colleague, or a third party is experiencing a specific issue when loading a web application. The problem is often related to the third-party tools (for example, specific browser version, added extensions) or a set of specific steps that the user undertakes to result in the observed behavior. With Fiddler Everywhere, the user can easily capture and share the sessions with you for further investigation. Going one step further, Fiddler Everywhere allows you to mock multiple sessions just as they initially appeared.

## Creating and Using a "Mock Traffic" Rule

Fiddler can mock HTTPS traffic captured locally or remotely, for example, as traffic captured by another instance of Fiddler Everywhere and shared as a cloud session or SAZ archive. The following steps showcase how to use a SAZ archive to load and mock the captured traffic (in this case, as loaded from [https://example.com)](https://example.com/)).

1. Capture the targeted HTTPS traffic or import a SAZ archive (containing the sessions snapshot) in the Snapshots list.
   ![Loading SAZ archive with captured traffic](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/assets/81a6fbc0b06f01b516f06d4bc4c7856a/mock-rules-saz.png)
2. Select all sessions (`Ctrl`+`A` on Windows or `Cmd`+`A` on macOS).
3. Right-click to invoke the context menu and choose **Add New Rules**. At this point, Fiddler will automatically generate rules for each captured session and create a parent group. The group's name will be "Selection Import" followed by a timestamp.
   ![Loading SAZ archive with captured traffic](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/assets/de5a0e63b88a3af5a9844d957b38496a/mock-rules-saz-tab.png)

**OR**

1. Import the SAZ archive with the captured traffic in the **Rules** tab. At this point, Fiddler will automatically generate rules for each captured session and create a parent group. The group's name will be "File Import" followed by a timestamp. Once the mock rules are created through the above methods, you can add modifications (within the newly created rules) and then use them with live traffic.
   ![Loading SAZ in RUles tab to automaticaly created a set of new rules](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/assets/0e10306acd993e5076d3298a0d2c57ec/importing-saz-in-rules-tab.png)
2. (Optional) Modify the newly generated rules (for example, you can change the request/response headers and bodies).
3. Switch the Fiddler tabs from the saved session snapshot to the **Live Traffic** tab.
4. Ensure that the switches for the newly created rule group and the **Rules** tab are toggled ON (refer to the screenshot below). Note that the switches are available only when the Live Traffic tab is focused.
   ![Loading SAZ archive with captured traffic](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/assets/cdc40a75133fb8ae32879ce5fd721f2f/mock-rules-live-traffic-tab.png)

The next step is to use one of the Fiddler capturing modes and initiate the traffic capturing (the rules will work only for traffic that goes through the Fiddler proxy). For Example:

1. Use the **Browser** to start [the browser capturing mode](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/capture-traffic/capture-browser-traffic).
2. Load the URL used by the client to generate the captured sessions (in our case, that would be [https://example.com)](https://example.com/))

At this point, the shown page is not the original one but the page as mocked from the active Fiddler rules.

## See Also

* [Fiddler Rules Archives (FARX)](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/knowledge-base/fiddler-rules-archives)
* [Modifying HTTPS Traffic](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/modify-traffic-with-rules)
* [Using Breakpoints](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/breakpoints)
* [Example for using predefined actions in the Rules tab](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/knowledge-base/using-ar-predefined-actions)
* [Example for redirecting through the Rules tab](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/knowledge-base/redirecting-with-rulesbuilder)
* [Example for turning off caching through the Rules tab](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/knowledge-base/create-a-rule-to-disable-cache)
* [Example for creating manual HTTP Responses](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/knowledge-base/how-to-mock-responses)
* [Understanding the matching conditions and Final vs. Non-Final Actions](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/conditions-and-actions)
* [Introducing the Rules tab (blog post)](https://www.telerik.com/blogs/introducing-new-rule-builder-fiddler-everywhere)
