8.5 HTTP cache
Prev | Chapter 8 Configuration of network services | Next

## 8.5 HTTP cache

Using cache to access Web pages that are opened repeatedly reduces Internet traffic (in case of line where traffic is counted, it is also remarkable that using of cache decreases total volume of transferred data). Downloaded files are saved to the hard drive of the WinRoute host so that it is not necessary to download them from the web server again later.

All objects are stored in cache for a certain time only (Time To Live — TTL). This time defines whether checks for the most recent versions of the particular objects will be performed upon a new request of the page. The required object will be found in cache unless the TTL timeout has expired. If it has expired, a check for a new update of the object will be performed. This ensures continuous update of objects that are stored in the cache.

The cache can be used either for direct access or for access via the proxy server. If you use direct access, the HTTP protocol inspector must be applied to the traffic. In the default configuration of WinRoute, this condition is met for the HTTP protocol at the default port `80` (for details, see chapters 7.3 Definition of Custom Traffic Rules and 14.3 Services).

To set HTTP cache parameters go to the Cache tab in Configuration → Content Filtering → HTTP Policy.

Figure 8.16. HTTP cache configuration

Enable cache on transparent proxy

  This option enables cache for HTTP traffic that uses the HTTP protocol inspector (direct access to the Internet).

Enable cache on proxy server

  Enables the cache for HTTP traffic via WinRoute's proxy server (see chapter 8.4 Proxy server).

HTTP protocol TTL

  Default time of object validity within the cache. This time is used when:

  - TTL of a particular object is not defined (to define TTL use the URL specific settings button —see below)

  - TTL defined by the Web server is not accepted (the Use server supplied Time-To-Live entry)

Cache directory

  Directory that will be used to store downloaded objects. The `cache` file under the directory where WinRoute is installed is used by default.

  ### Warning

  Changes in this entry will not be accepted unless the WinRoute Firewall Engine is restarted. Old cache files in the original folder will be removed automatically.

Cache size

  Size of the cache file on the disk. Maximal cache size allowed is 2 GB (2047 MB)

  Note:

  1. If 98 per cent of the cache is full, a so called cleaning will be run — this function will remove all objects with expired TTL. If no objects are deleted successfully, no other objects can be stored into the cache unless there is more free space on the disk (made by further cleaning or by manual removal).

  2. The maximal cache size is applied in WinRoute since 6.2.0. In older versions, maximal cache size allowed was 4 GB (the threshold was cut for technical reasons). If, upon its startup, the WinRoute Firewall Engine detects that the cache size exceeds 2047 MB, the size is changed to the allowed value automatically.

  3. If the maximum cache size set is larger than the free space on the corresponding disk, the cache is not initialized and the following error is recorded in the Error log (see chapter 22.8 Error Log).

Max HTTP object size

  maximal size of the object that can be stored in cache.

  With respect to statistics, the highest number of requests are for small objects (i.e. HTML pages, images, etc.). Big sized objects, such as archives (that are usually downloaded at once), would require too much memory in the cache.

Cache Options

  Advanced options where cache behavior can be defined.

  - Continue aborted download — tick this option to enable automatic download of objects that have been aborted by the user (using the Stop button in a browser). Users often abort downloads for slow pages. If any user attempts to open the same page again, the page will be available in the cache and downloads will be much faster.

  - Cache responses '302 Redirect' — this option accelerates connection to redirected web pages.

    Under usual circumstances, 302 Redirect responses are not cached. HTTP protocol's return code 302 stands for temporary redirection — such redirection can be canceled any time or the target URL can change. If user applies the cached response to open a web page, the client can be redirected to an obsolete or invalid URL.

  - Use server supplied Time-To-Live — objects will be cached for time specified by the Web server from which they are downloaded. If TTL is not specified by the server, the default TTL will be used (see the HTTP protocol TTL item).

    ### Warning

    Some web servers may attempt to bypass the cache by too short/long TTL.

  - Ignore server Cache-Control directive — WinRoute will ignore directives for cache control of Web pages.

    Pages often include a directive that the page will not be saved into the cache. This directive page may be misused for example to bypass the cache. Enable the Ignore server Cache-Control directive option to make WinRoute accept only no-store and private directives.

    Note: WinRoute examines HTTP header directives of responses, not Web pages.

  - Always validate file in cache — with each query WinRoute will check the server for updates of objects stored in the cache (regardless of whether the client demands this).

Note: Clients can always require a check for updates from the Web server (regardless of the cache settings). Use combination of the Ctrl and the F5 keys to do this using either the Internet Explorer or the Firefox/SeaMonkey browser. You can set browsers so that they will check for updates automatically whenever a certain page is opened (then you will only refresh the particular page).

### URL Specific Settings

The default cache TTL of an object is not necessarily convenient for each page. You may require not to cache an object or shorten its TTL (i.e. for pages that are accessed daily).

Use the URL specific settings button to open a dialog where TTL for a particular URL can be defined.

Figure 8.17. HTTP cache — specific settings for URL

Rules within this dialog are ordered in a list where the rules are read one by one from the top downwards (use the arrow buttons on the right side of the window to reorder the rules).

Description

  Text comment on the entry (informational purpose only)

URL

  URL for which cache TTL will be specified. URLs can have the following forms:

  - complete URL (i.e. `www.kerio.com/us/index.html`)

  - substring using wildcard matching (i.e. `*news.com*`)

  - server name (i.e. `www.kerio.com`) — represents any URL included at the server (the string will be substituted for `www.kerio.com/*` automatically.

TTL

  TTL of objects matching with the particular URL.

  The 0 days, 0 hours option means that objects will not be cached.

### Cache status and administration

WinRoute allows monitoring of the HTTP cache status as well as manipulation with objects in the cache (viewing and removing).

At the bottom of the Cache tab, basic status information is provided such as the current cache size occupied and efficiency of the cache. The efficiency status stands for number of objects kept in the cache (it is not necessary to download these objects from the server) in proportion to the total number of queries (since the startup of the WinRoute Firewall Engine). The efficiency of the cache depends especially on user behavior and habits (if users visit certain webpages regularly, if any websites are accessed by multiple users, etc.) and, in a manner, it can be also affected by the configuration parameters described above. If the efficiency of the cache is permanently low (less than 5 per cent), it is recommended to change the cache configuration.

Figure 8.18. HTTP cache status information

Use the Manage cache content... button to open a dialog where objects kept in cache can be viewed, searched and/or removed.

Figure 8.19. HTTP cache administration dialog

To view objects in cache, specify the searched object in the URL entry. Objects can be specified either by an absolute URL (without protocol) — e.g. `www.kerio.com/image/menu.gif` or as a URL substring with `*` (substituting any number of any symbols and characters) and `?` (question mark substitutes a single character or symbol) wildcard symbols.

### Example

Search for the `*ker?o*` string lists all objects with URL matching the specification, such as `kerio`, `kerbo`, etc.

Each line with an object includes URL of the object, its size in bytes (B) and number of hours representing time left to the expiration. To keep the list simple and well-organized, up to 100 items are displayed at a single page. The Previous and Next buttons can be used for browsing through the list pages.

The Remove button can be used to delete the selected object from the cache.

### Hint

By clicking and dragging or by clicking and holding the Ctrl or Shift key, it is possible to select multiple objects.

Prev | Up | Next
8.4 Proxy server | Contents | Chapter 9 Bandwidth Limiter