Fortinet white logo
Fortinet white logo

Administration Guide

Caching

Caching

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

Normally, FortiWeb forwards all allowed requests to your servers. This results in a 1:1 ratio of client-side to server-side traffic. When content caching is enabled, however, FortiWeb will forward only requests for content that:

When many requests are for cached content, the ratio of traffic changes to n:1.

Content caching provides the greatest benefit for things that rarely change, such as icons, background images, movies, PDFs, and static HTML.

To configure web content caching
Response caching is not supported on FortiWeb 400B due to limited available memory.
  1. If you want to cache all URLs except for a few, go to Application Delivery > Caching and select the Web Cache Exceptions tab. Otherwise, skip to Go to Application Delivery > Caching and select the Web Cache Policy tab..
  2. Click Create New.
  3. In Name, type a name that can be referenced by other parts of the configuration. The maximum length is 63 characters.
  4. Click OK.
  5. Click Create New.
  6. Configure these settings:
    note icon

    You can omit items from the cache by matching the request URL, its cookie name, or both. Some URLs may not require exceptions because they inherently cannot be cached. For details, see What can be cached?.

    Host Status Enable to require that the Host: field of the HTTP request match a protected host names entry in order to match the exception. Also configure Host.
    Host

    Select which protected host names entry (either a web host name or IP address) that the Host: field of the HTTP request must be in to match the exception.

    This option is available only if Host Status is enabled.

    Type Indicate whether URL Pattern is a Simple String (that is, a literal URL) or a Regular Expression.
    URL Pattern

    Depending on your selection in Type, enter either:

    • the literal URL, such as /index.php, that the HTTP request must contain in order to match the rule. The URL must begin with a slash ( / ).
    • a regular expression, such as ^/*.php, matching all and only the URLs to which the rule should apply. The pattern does not require a slash ( / ); however, it must at match URLs that begin with a slash, such as /index.cfm.

    Do not include the domain name, such as www.example.com, which is configured separately in the Host drop-down list.

    To create and test a regular expression, click the >> (test) icon. This opens the Regular Expression Validator window where you can fine-tune the expression. For details, see Regular expression syntax.

    Tip: Generally, URLs that require autolearning adapters do not work well with caching either. Dynamic URLs that contain variables such as user names (e.g. older versions of Microsoft OWA) or volatile data such as parameters usually should not be cached. Because FortiWeb is unlikely to receive identical subsequent requests for them, dynamic URLs can rapidly consume cache without improving performance.

    Cookie Name

    Type the name of the cookie, such as sessionid, as it appears in the Cookie: HTTP header.

    Tip: Content that is unique to a user, such as personalized pages that appear after a person has logged in, usually should not be cached. If the web application’s authentication is cookie-based, configure this setting with the name of the authentication cookie. Otherwise, if it is parameter-based, configure the exception with a URL pattern that matches the authentication ID parameter.

  7. Click OK.
  8. Repeat the previous steps for each entry that you want to add to the exception.
  9. Go to Application Delivery > Caching and select the Web Cache Policy tab.
  10. Click Create New.
  11. Configure these settings:
    Host

    Select which protected host names entry (either a web host name or IP address) that the Host: field of the HTTP request must be in to match the policy.

    This option is available only if Host Status is enabled.

    Cache Buffer Size

    Type the maximum size in megabytes (MB) of RAM to allocate to caching content.

    Storing cached content to FortiWeb’s hard disk is not supported.

    Tip: For improved performance, adjust this setting until it is as small as possible yet FortiWeb can still fit most graphics and server processing-intensive pages into its cache. This allows FortiWeb to allocate more RAM to other features that also affect throughput, such as scanning for attacks.

    Maximum Cached Page Size

    Type the maximum size in kilobytes (KB) of each URL that FortiWeb will cache. Objects such as high-resolution images, movies, or music that are larger than this limit will not be cached.

    Tip: For improved performance, adjust this setting until FortiWeb can fit most graphics and server processing-intensive pages into its cache.

    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 to forward the request to the server in order to cache the response again. Any additional requests will receive FortiWeb’s cached response until the URL’s cache timeout occurs.

    Exception Select a list of exceptions, if any, to this list of cached URLs. Click the icon to view or edit exceptions.
  12. Click OK.
  13. To automatically cache all URLs except for those in Exception, skip to To apply the rewriting policy, select it in an inline protection profile. For details, see Configuring a protection profile for inline topologies.. Otherwise, to manually specify which URLs to cache, click Create New to create a new web cache policy item rule.
  14. Configure these settings:
    Host Status Enable to require that the Host: field of the HTTP request match a protected host names entry in order to match the policy. Also configure Host.
    Host

    Select which protected host names entry (either a web host name or IP address) that the Host: field of the HTTP request must be in to match the policy.

    This option is available only if Host Status is enabled.

    Type Indicate whether URL Pattern is a Simple String (that is, a literal URL) or a Regular Expression.
    URL Pattern

    Depending on your selection in Type, enter either:

    • the literal URL, such as /index.php, that the HTTP request must contain in order to match the policy. The URL must begin with a slash ( / ).
    • a regular expression, such as ^/*.php, matching all and only the URLs to which the policy should apply. The pattern does not require a slash ( / ); however, it must at match URLs that begin with a slash, such as /index.cfm.

    Do not include the domain name, such as www.example.com, which is configured separately in the Host drop-down list.

    To create and test a regular expression, click the >> (test) icon. This opens the Regular Expression Validator window where you can fine-tune the expression. For details, see Regular expression syntax.

  15. Click OK.
  16. Repeat the previous steps for each URL that you want to cache.
  17. Omitting a URL from the table is equivalent to creating an exception: if the table is not empty, FortiWeb will only cache URLs that you list in this table.

  18. To apply the rewriting policy, select it in an inline protection profile. For details, see Configuring a protection profile for inline topologies.
See also

Caching

Caching

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

Normally, FortiWeb forwards all allowed requests to your servers. This results in a 1:1 ratio of client-side to server-side traffic. When content caching is enabled, however, FortiWeb will forward only requests for content that:

When many requests are for cached content, the ratio of traffic changes to n:1.

Content caching provides the greatest benefit for things that rarely change, such as icons, background images, movies, PDFs, and static HTML.

To configure web content caching
Response caching is not supported on FortiWeb 400B due to limited available memory.
  1. If you want to cache all URLs except for a few, go to Application Delivery > Caching and select the Web Cache Exceptions tab. Otherwise, skip to Go to Application Delivery > Caching and select the Web Cache Policy tab..
  2. Click Create New.
  3. In Name, type a name that can be referenced by other parts of the configuration. The maximum length is 63 characters.
  4. Click OK.
  5. Click Create New.
  6. Configure these settings:
    note icon

    You can omit items from the cache by matching the request URL, its cookie name, or both. Some URLs may not require exceptions because they inherently cannot be cached. For details, see What can be cached?.

    Host Status Enable to require that the Host: field of the HTTP request match a protected host names entry in order to match the exception. Also configure Host.
    Host

    Select which protected host names entry (either a web host name or IP address) that the Host: field of the HTTP request must be in to match the exception.

    This option is available only if Host Status is enabled.

    Type Indicate whether URL Pattern is a Simple String (that is, a literal URL) or a Regular Expression.
    URL Pattern

    Depending on your selection in Type, enter either:

    • the literal URL, such as /index.php, that the HTTP request must contain in order to match the rule. The URL must begin with a slash ( / ).
    • a regular expression, such as ^/*.php, matching all and only the URLs to which the rule should apply. The pattern does not require a slash ( / ); however, it must at match URLs that begin with a slash, such as /index.cfm.

    Do not include the domain name, such as www.example.com, which is configured separately in the Host drop-down list.

    To create and test a regular expression, click the >> (test) icon. This opens the Regular Expression Validator window where you can fine-tune the expression. For details, see Regular expression syntax.

    Tip: Generally, URLs that require autolearning adapters do not work well with caching either. Dynamic URLs that contain variables such as user names (e.g. older versions of Microsoft OWA) or volatile data such as parameters usually should not be cached. Because FortiWeb is unlikely to receive identical subsequent requests for them, dynamic URLs can rapidly consume cache without improving performance.

    Cookie Name

    Type the name of the cookie, such as sessionid, as it appears in the Cookie: HTTP header.

    Tip: Content that is unique to a user, such as personalized pages that appear after a person has logged in, usually should not be cached. If the web application’s authentication is cookie-based, configure this setting with the name of the authentication cookie. Otherwise, if it is parameter-based, configure the exception with a URL pattern that matches the authentication ID parameter.

  7. Click OK.
  8. Repeat the previous steps for each entry that you want to add to the exception.
  9. Go to Application Delivery > Caching and select the Web Cache Policy tab.
  10. Click Create New.
  11. Configure these settings:
    Host

    Select which protected host names entry (either a web host name or IP address) that the Host: field of the HTTP request must be in to match the policy.

    This option is available only if Host Status is enabled.

    Cache Buffer Size

    Type the maximum size in megabytes (MB) of RAM to allocate to caching content.

    Storing cached content to FortiWeb’s hard disk is not supported.

    Tip: For improved performance, adjust this setting until it is as small as possible yet FortiWeb can still fit most graphics and server processing-intensive pages into its cache. This allows FortiWeb to allocate more RAM to other features that also affect throughput, such as scanning for attacks.

    Maximum Cached Page Size

    Type the maximum size in kilobytes (KB) of each URL that FortiWeb will cache. Objects such as high-resolution images, movies, or music that are larger than this limit will not be cached.

    Tip: For improved performance, adjust this setting until FortiWeb can fit most graphics and server processing-intensive pages into its cache.

    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 to forward the request to the server in order to cache the response again. Any additional requests will receive FortiWeb’s cached response until the URL’s cache timeout occurs.

    Exception Select a list of exceptions, if any, to this list of cached URLs. Click the icon to view or edit exceptions.
  12. Click OK.
  13. To automatically cache all URLs except for those in Exception, skip to To apply the rewriting policy, select it in an inline protection profile. For details, see Configuring a protection profile for inline topologies.. Otherwise, to manually specify which URLs to cache, click Create New to create a new web cache policy item rule.
  14. Configure these settings:
    Host Status Enable to require that the Host: field of the HTTP request match a protected host names entry in order to match the policy. Also configure Host.
    Host

    Select which protected host names entry (either a web host name or IP address) that the Host: field of the HTTP request must be in to match the policy.

    This option is available only if Host Status is enabled.

    Type Indicate whether URL Pattern is a Simple String (that is, a literal URL) or a Regular Expression.
    URL Pattern

    Depending on your selection in Type, enter either:

    • the literal URL, such as /index.php, that the HTTP request must contain in order to match the policy. The URL must begin with a slash ( / ).
    • a regular expression, such as ^/*.php, matching all and only the URLs to which the policy should apply. The pattern does not require a slash ( / ); however, it must at match URLs that begin with a slash, such as /index.cfm.

    Do not include the domain name, such as www.example.com, which is configured separately in the Host drop-down list.

    To create and test a regular expression, click the >> (test) icon. This opens the Regular Expression Validator window where you can fine-tune the expression. For details, see Regular expression syntax.

  15. Click OK.
  16. Repeat the previous steps for each URL that you want to cache.
  17. Omitting a URL from the table is equivalent to creating an exception: if the table is not empty, FortiWeb will only cache URLs that you list in this table.

  18. To apply the rewriting policy, select it in an inline protection profile. For details, see Configuring a protection profile for inline topologies.
See also