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. |
- Configure these settings.
- GET, HEAD (Recommended)
- GET, HEAD, OPTIONS
- GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE
- 200 (Recommended)
- 200, 206
- 200, 206, 301, 302
- Text
- Picture
- Media
- Binary
- Other
- 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”
. - Cookies—Once 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.
- Click Create New to configure the URLs not to be cached.
- Configure these settings.
HTTP Method
Select the HTTP method in which the request URL is included.
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.
- Click OK. You can continue creating multiple Bypass Sub URL lists.
- Enable Compression to completely offload compression to FortiWeb Cloud to save resources on your web servers.
- 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.
- Click SAVE.
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. |
Allow Return Code |
Select whether to cache the response contents according to the response code. |
Allow File Type |
Select whether to cache the response contents according to the content type. |
Key Generation Factor |
Select the protocol variable that you want to use to generate the cache key. |
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
-