Fortinet black logo

User Guide

Caching and Compression

Copy Link
Copy Doc ID 2ffc9903-bcb4-11e9-8977-00505692583a:457988
Download PDF

Caching and Compression

To improve performance of your back-end network and servers by reducing their traffic and processing load, you can configure FortiWeb Cloud to cache and compress responses from your servers.

To configure Caching and Compression, you must have already enabled this module in Add Modules. See How to add or remove a module.

When enabling caching make sure you correctly configured the web server’s no-cache/no-store directives to avoid caching sensitive data.
  1. Configure these settings.
  2. Default Cache Timeout

    Type the time to live for each entry in the cache. Expired entries will be removed.

    A subsequent request for the URL will cause FortiWeb Cloud to forward the request to the server in order to cache the response again. Any additional requests will receive FortiWeb Cloud’s cached response until the URL’s cache timeout occurs.

    Allow HTTP Method

    Select whether to cache the response contents according to the HTTP method you use.

    • GET, HEAD (Recommended)
    • GET, HEAD, OPTIONS
    • GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE

    Allow Return Code

    Select whether to cache the response contents according to the response code.

    • 200 (Recommended)
    • 200, 206
    • 200, 206, 301, 302

    Allow File Type

    Select whether to cache the response contents according to the content type.

    • Text
    • Picture
    • Media
    • Binary
    • Other

    Key Generation Factor

    Select the protocol variable that you want to use to generate the cache key.

    • Method, such as GET, POST, HEAD, etc.
    • Protocol, the string can be either “http://” or “https://”;
    • Host
    • URL
    • Arguments, for example in request http://host.com/test.php?a=1&b=2
      , the Arguments string is “a=1&b=2”.
    • CookiesOnce you have created a web cache rule, you can edit the rule to indicate cookies in HTTP requests and append them to the key string to generate the cache key.
  3. Click Create New to configure the URLs not to be cached.
  4. Configure these settings.

    HTTP Method

    Select the HTTP method in which the request URL is included.

    URL Expression

    Enter a regular expression, such as ^/*.php, matching the sub URLs to which the rule should apply. The pattern does not require a slash ( / ), but it must match sub URLs that begin with a slash, such as /index.cfm.

    For details, see "Regular expression syntax" on page 1.

    Bypass Arguments

    Enable this option and enter the argument name so that the request matches the bypass URL only when the request brings the specific arguments.

    Bypass Cookies

    Enable this option and enter the cookie name so that the request matches the bypass URL only when the request brings the specific cookies.

  5. Click OK. You can continue creating multiple Bypass Sub URL lists.
  6. Enable Compression to completely offload compression to FortiWeb Cloud to save resources on your web servers.
  7. Select the content types that you want to compress. Click Change, select the content type, and then click the right arrow (->) to move them to the Allow Content Types list.
  8. Click SAVE.

You can click the Clear Cache button at the top right corner of the page to clear the responses cached on FortiWeb Cloud.

What can be cached?

Caching generally works best with data that doesn't change. Things like static web pages, images, movies, and music all typically work well.

When content changes often, caching provides overhead by consuming RAM without its usual benefit of reduced latency. Some HTTP headers and other factors indicate dynamic content which FortiWeb Cloud will not cache.

FortiWeb Cloud will not cache responses if the request:

  • Has fields such as Cache-Control: no-cache/no-store/; Pragma:no-cache
  • Contains the header:
    • Authorization
    • Proxy-Authorization

FortiWeb Cloud will not cache if the response:

  • Has a Set-Cookie: field

  • Has a Vary: field

  • Has fields such as Cache-Control: no-cache/no-store/private; Pragma:no-cache; Cache-Control: max-age=0

  • Contains the header:

    • Proxy-Authorization

    • Connection

    • Keep-Alive

    • Proxy-Authenticate

    • TE

    • Trailers

    • Transfer-Encoding

    • Upgrade

Caching and Compression

To improve performance of your back-end network and servers by reducing their traffic and processing load, you can configure FortiWeb Cloud to cache and compress responses from your servers.

To configure Caching and Compression, you must have already enabled this module in Add Modules. See How to add or remove a module.

When enabling caching make sure you correctly configured the web server’s no-cache/no-store directives to avoid caching sensitive data.
  1. Configure these settings.
  2. Default Cache Timeout

    Type the time to live for each entry in the cache. Expired entries will be removed.

    A subsequent request for the URL will cause FortiWeb Cloud to forward the request to the server in order to cache the response again. Any additional requests will receive FortiWeb Cloud’s cached response until the URL’s cache timeout occurs.

    Allow HTTP Method

    Select whether to cache the response contents according to the HTTP method you use.

    • GET, HEAD (Recommended)
    • GET, HEAD, OPTIONS
    • GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE

    Allow Return Code

    Select whether to cache the response contents according to the response code.

    • 200 (Recommended)
    • 200, 206
    • 200, 206, 301, 302

    Allow File Type

    Select whether to cache the response contents according to the content type.

    • Text
    • Picture
    • Media
    • Binary
    • Other

    Key Generation Factor

    Select the protocol variable that you want to use to generate the cache key.

    • Method, such as GET, POST, HEAD, etc.
    • Protocol, the string can be either “http://” or “https://”;
    • Host
    • URL
    • Arguments, for example in request http://host.com/test.php?a=1&b=2
      , the Arguments string is “a=1&b=2”.
    • CookiesOnce you have created a web cache rule, you can edit the rule to indicate cookies in HTTP requests and append them to the key string to generate the cache key.
  3. Click Create New to configure the URLs not to be cached.
  4. Configure these settings.

    HTTP Method

    Select the HTTP method in which the request URL is included.

    URL Expression

    Enter a regular expression, such as ^/*.php, matching the sub URLs to which the rule should apply. The pattern does not require a slash ( / ), but it must match sub URLs that begin with a slash, such as /index.cfm.

    For details, see "Regular expression syntax" on page 1.

    Bypass Arguments

    Enable this option and enter the argument name so that the request matches the bypass URL only when the request brings the specific arguments.

    Bypass Cookies

    Enable this option and enter the cookie name so that the request matches the bypass URL only when the request brings the specific cookies.

  5. Click OK. You can continue creating multiple Bypass Sub URL lists.
  6. Enable Compression to completely offload compression to FortiWeb Cloud to save resources on your web servers.
  7. Select the content types that you want to compress. Click Change, select the content type, and then click the right arrow (->) to move them to the Allow Content Types list.
  8. Click SAVE.

You can click the Clear Cache button at the top right corner of the page to clear the responses cached on FortiWeb Cloud.

What can be cached?

Caching generally works best with data that doesn't change. Things like static web pages, images, movies, and music all typically work well.

When content changes often, caching provides overhead by consuming RAM without its usual benefit of reduced latency. Some HTTP headers and other factors indicate dynamic content which FortiWeb Cloud will not cache.

FortiWeb Cloud will not cache responses if the request:

  • Has fields such as Cache-Control: no-cache/no-store/; Pragma:no-cache
  • Contains the header:
    • Authorization
    • Proxy-Authorization

FortiWeb Cloud will not cache if the response:

  • Has a Set-Cookie: field

  • Has a Vary: field

  • Has fields such as Cache-Control: no-cache/no-store/private; Pragma:no-cache; Cache-Control: max-age=0

  • Contains the header:

    • Proxy-Authorization

    • Connection

    • Keep-Alive

    • Proxy-Authenticate

    • TE

    • Trailers

    • Transfer-Encoding

    • Upgrade