config load-balance : config load-balance caching
 
config load-balance caching
Use this command to configure the system cache.
The system cache can store HTTP content. The system can serve subsequent HTTP requests for that content without forwarding the requests to the backend servers, thereby reducing the load on the backend servers.
In general, the RAM cache conforms with the cache requirements described in sections 13 and 14 in RFC 2616.
If caching is enabled for the profile that is applied to traffic processing, the system evaluates HTTP responses to determine whether or not to cache the content. HTTP responses with status codes 200, 203, 300, 301, 400 can be cached.
The following content is not cached:
A response that does not include the Content-Length header.
A response for a request that uses any method other than GET.
A response for a request of which URI is contained in URI Exclude List.
A response for a request that contains any of the following headers: If-Match, If-Unmodified-Since, Authorization, Proxy-Authorization.
A response that contains any of the following headers: Pragma, Vary, Set-Cookie, and Set-Cookie2.
A response that does not contain the following headers: Cache-Control, Expires.
A response with a Cache-Control header that has one of the following values: no-cache, no-store, private.
A response with a Cache-Control header that does not have any of the following values: public, max-age, s-maxage.
In addition, content is not cached if the user-configured RAM cache thresholds described below are exceeded, or if the content is contained in a response for a request to a URI in the user-specified URI Exclude List.
Before you begin:
You must have a good understanding of caching and knowledge about the size of content objects clients access on the backend servers.
You must have read-write permission for load balancing settings.
Caching is not enabled by default. After you have configured caching, you can select it in the profile configuration. To enable caching, select the profile when you configure the virtual server.
Syntax
config load-balance caching
edit <name>
set max-age <integer>
set max-cache-size <integer>
set max-entries <integer>
set max-object-size <integer>
config uri_exclude_list
edit <No.>
set uri <string>
next
end
next
end
max-age
The default is 43,200 seconds. The valid range is 60 to 86,400.
The backend real server response header also includes a maximum age value. The FortiADC system enforces whichever value is smaller.
max-cache-size
The default is 100 MB. The valid range is 1 byte to 500 MB.
max-entries
The default is 10,000. The valid range is 1 to 262,144.
max-object-size
The default is 1 MB. The valid range is 1 byte to 10 MB.
config uri_exclude_list
uri
Specify URIs to build a list or sites to exclude from caching. You can use regular expressions.
Example
FortiADC-VM # config load-balance caching
 
FortiADC-VM (caching) # edit lb-caching
Add new entry 'lb-caching' for node 2054
FortiADC-VM (lb-caching) # get
max-object-size : 1M
max-cache-size : 100M
max-entries : 10000
max-age : 43200
 
FortiADC-VM (lb-caching) # set max-cache-size 50M
FortiADC-VM (lb-caching) # end