# Creating a Rule to Disable Caching

## Environment

|         |                    |
| ------- | ------------------ |
| Product | Fiddler Everywhere |

## Description

I want to always get the latest content from the server. How to prevent the server or client application from caching an HTTP(S) Request or Response?

## Solution

You can use the **Rules** tab to create and apply a rule for all traffic that goes through the proxy.

* Create a condition that matches all captured traffic. For demonstration purposes we are using regular expression `.*` which matches every string.
  ![Matching all traffic through ReGex](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/assets/be51f0f965570a3d3ec7702e64df4b2b/disable-caching-rule-condition.png)
* Add actions to overwrire and remove all HTTP Requests and Responses Headers that are related to caching:

  | Fiddler Action             | Headers                        | Value                                 | Action    |
  | -------------------------- | ------------------------------ | ------------------------------------- | --------- |
  | **Update Request Header**  | `If-Modified-Since`            | any                                   | Remove    |
  | **Update Request Header**  | `Pragma`                       | `no-cache`                            | Set Value |
  | **Update Request Header**  | `Cache-Control`                | `no-cache, no-store, must-revalidate` | Set Value |
  | **Update Response Header** | `Expires, Last-Modified, ETag` | any                                   | Remove    |
  | **Update Response Header** | `Expires`                      | `0`                                   | Set Value |
  | **Update Response Header** | `Cache-Control`                | `no-cache, no-store, must-revalidate` | Set Value |

  As a result, the newly created rule looks like this:
  ![Disable Caching rules](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/assets/51cf71db68c1d6c88c0f39e0ab283a43/disable-caching-rule.png)
* Enable the **Rules** tab and the newly created rule.
  ![Enabling the rule](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/assets/216dc6637977b0162bfc1eca82c94153/disable-caching-rule-enabled.png)

## See Also

* [Sample Rules Presets](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/rules-presets)
* [Using Breakpoints](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/breakpoints)
* [Understanding the Matching Conditions and the Actions](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/conditions-and-actions#conditions)
* [Understanding the role of Final and Non-Final Actions](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/conditions-and-actions#final-and-non-final-actions)
