06-Layer 3—IP Services Configuration Guide

HomeSupportConfigure & DeployConfiguration GuidesH3C SR6600[SR6600-X] Routers Configuration Guides(V7)-R8149-6W10006-Layer 3—IP Services Configuration Guide
21-Web caching configuration
Title Size Download
21-Web caching configuration 296.42 KB

Configuring Web caching

About Web caching

The Web caching feature saves specific webpage content requested by HTTP or HTTPS users from specific Web servers to files in the Web cache directory. If users access the same content before the content is aged out, the device retrieves the content from the files and sends the content to the users. Web caching can reduce the traffic between the device and the Web servers, lower Web content transmission costs, relieve pressure on Web servers, and improve user Web access speed.

Basic concepts

·     Web cache files and Web cache directory—The Web caching feature saves its operation data and the Web content to be cached to files in the Web cache directory. After the effective maximum total size for Web cache files is reached, the device deletes the oldest Web cache file to save the new Web cache file.

·     TCP listening port:

¡     Listening port for Web caching—Provides the Web cache service on the device. Only packets sent to this port will be processed by Web caching.

¡     Listening port for the Web server—Provides the Web service on the Web server. Only packets sent to this port will be processed by Web.

·     Web cache file aging time—The Web cache file aging time is fixed at 30 days. When the device reboots or receives a request for the cached content in a file, it restarts the aging timer. If no users request the cached content before the aging timer expires, the device deletes the file.

Web caching mechanism

Figure 1 shows the Web caching mechanism.

Figure 1 Web caching mechanism

 

1.     The host sends an HTTP or HTTPS GET request to the device.

2.     The device identifies whether the destination port number in the request is the same as the listening port number used by the Web server. If yes, the device replaces the destination port number with the listening port number specified for Web caching to trigger the Web caching process.

3.     The Web caching process obtains the URL of the request and looks up its cache for the requested content.

¡     If the requested content is found in the cache, the device retrieves the content and sends the content to the host. The HTTP or HTTPS GET operation is completed.

¡     If the requested content is not found, the device re-constructs the request and sends the request to the Web server.

4.     The Web server sends the requested content to the device.

5.     The device identifies whether the Web caching feature is configured to cache the content.

¡     If yes, the device uses the Web caching feature to cache the content, re-constructs a response, and sends the response to the host.

¡     If not, the device re-constructs a response and sends the response to the host.

Before sending the response, the device will check whether the source port number is the same as the listening port number used by Web caching. If not, the device will replace the source port number in the response with the listening port number of the Web server.

Web caching backup

The Web cache backup feature enhances the high availability of the Web caching service. You can specify a primary slot and a backup slot for Web caching. When the primary slot fails, the backup slot will take over to provide the Web caching service to ensure service continuity. When the primary slot recovers, the Web caching service switches back to the primary slot.

You can also specify a primary Web caching directory and a backup Web caching directory, which  are used by the primary and backup slots to provide the Web caching service, respectively.

License requirement for Web caching

The Web caching feature requires a license. If you configure the feature without a license, the settings will be lost after a device reboot. For information about feature licensing, see Fundamentals Configuration Guide.

Restrictions and guidelines: Web caching configuration

Before configuring or modifying Web caching parameters, you must disable Web caching. After configuring or modifying Web caching parameters, enable Web caching again.

Web caching tasks at a glance

To configure Web caching, perform the following tasks:

1.     Configuring webpage file filtering

2.     (Optional.) Specifying the aging time for Web cache files

3.     (Optional.) Configuring Web client and server filtering

4.     Specifying listening port numbers

5.     Configuring Web cache file storage parameters

6.     (Optional.) Configuring extended Web caching features

¡     Configuring traffic direction channels for Web cache dual gateways

¡     Enabling Web caching for files in QueryString of a URL

¡     Configuring Web caching to ignore the specified HTTP/HTTPS response headers

7.     Enabling Web caching

8.     (Optional.) Configuring Web caching backup

Configuring webpage file filtering

About this task

By default, Web caching can cache all webpage files. Perform this task to filter webpage files to be cached.

Web caching supports the following forward filtering rules:

·     Filter webpage files to be cached by file type.

·     Filter webpage files to be cached by file name.

·     Filter webpage files to be cached by file extension.

If you configure any of the forward filtering rules, Web caching caches only webpage files that match the specified filtering rule. If you configure all the forward filtering rules, Web caching caches webpage files that match any of the filtering rules and takes priority to use the specified webpage file name to filter webpage files in exact match mode.

You can also configure reverse filtering rules. In the current software version, you can specify only the keywords in names of webpage files not to be cached. After you configure a reverse filtering rule, Web caching caches only webpage files that do not match the rule.

Prerequisites

Before configuring or modifying a webpage file filtering rule, you must disable Web caching. After configuring or modifying the webpage filtering rule, enable Web caching again.

Forward and reverse webpage file filtering rules are mutually exclusive. They cannot be both configured.

Configuring forward filtering rules

1.     Enter system view.

system-view

2.     Create and enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Specify the types of webpage files to be cached.

cached-data { apk | bmp | doc | docx | gif | gzip | ipa | jar | jpg | jpeg | mp4 | pdf | png | ppt | pptx | rar | swf | tar | txt | xls | xlsx | zip } *

By default, no webpage file types are specified. The Web caching feature does not cache any types of files on webpages.

4.     (Optional.) Specify webpage files to be cached.

cached-file file-name

By default, no webpage files to be cached are specified.

5.     (Optional.) Specify a file extension of webpage files to be cached.

cached-extension-name extension-name

By default, Web caching can cache all webpage files.

You can execute this command multiple times to specify multiple file extensions. A maximum of 64 file extensions are supported.

Configuring reverse filtering rules

1.     Enter system view.

system-view

2.     Create and enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Specify webpage files not to be cached.

cached-data exclude { acp | ashx | asp | cgi | chk | chm | eml | ephtml | html | json | php | phtml | shtml | ska | tmp | filename-keyword keyword }

By default, Web caching can cache all webpage files.

You can execute this command multiple times to specify multiple keywords in names of webpage files not to be cached. A maximum of 64 keywords are supported.

Specifying the aging time for Web cache files

About this task

The device deletes Web cache files that are not requested by users before the aging time expires to save the storage space. Perform this task to edit the aging time for Web cache files:

·     If the device storage space is sufficient, set a long aging time for Web cache files.

·     If the device storage space is insufficient, set a short aging time for Web cache files.

Procedure

1.     Enter system view.

system-view

2.     Create and enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Specify the aging time for Web cache files.

cached-data aging-time aging-time

By default, the aging time for Web cache files is 1440 minutes.

Configuring Web client and server filtering

About this feature

By default, Web caching caches webpage content from all Web servers. You can perform this task to configure Web client and server filtering.

The filtering mechanism varies by the keywords specified when you execute the object-group command.

·     If you specify both the exclude and source keywords, Web caching does not cache Web content requested by Web clients specified by the object group.

·     If you specify only the exclude keyword, Web caching does not cache Web content sent from Web servers specified by the object group.

·     If you specify only the source keyword, Web caching caches Web content requested by only Web clients specified by the object group.

·     If you specify neither the exclude nor the source keyword, Web caching caches Web content sent from only Web servers specified by the object group.

Restrictions and guidelines

If you specify an empty IP address object group to filter Web content, Web caching works as follows:

·     If you do not specify the exclude keyword, Web caching does not cache Web content of any Web servers and rejects Web content caching requests sent by any Web clients.

·     If you specify the exclude keyword, Web caching can cache Web content of all Web servers and permits Web content caching requests sent by all Web clients.

Prerequisites

Before you configure Web client and server filtering, you must complete the following tasks:

·     Configure an IP address object group. For more information about the IP address object group feature, see object group configuration in Security Configuration Guide.

·     Disable HTTP-based Web caching. After you complete the configuration, enable Web caching again.

Procedure

1.     Enter system view.

system-view

2.     Create and enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Specify an IP address object group used to filter Web content.

object-group [ exclude ] [ source ] { ip | ipv6 } object-group-name

By default, no IP address object group is specified for the Web caching feature to filter Web content.

Specifying listening port numbers

About this task

By default:

·     For HTTP, Web caching listens for HTTP packets on port number 4180 and caches Web resources from Web servers that use 80 as the HTTP listening port number.

·     For HTTPS, Web caching listens for HTTPS packets on port number 2043 and caches Web resources from Web servers that use 443 as the HTTPS listening port number.

Perform this task in either of the following situations:

·     A port number used by Web caching to listen for HTTP or HTTPS packets is used by another service on the device, which causes Web caching fails to be enabled.

·     A Web server does not listen for HTTP packets on port number 80 or HTTPS packets on port number 443.

Restrictions and guidelines

If Web caching caches webpage files from multiple Web servers that use different listening port numbers, you must configure multiple listening port number pairs for the Web servers. A listening port number for Web caching and a listening port number for a Web server is a listening port number pair.

For each protocol (HTTP or HTTPS), you can specify a maximum of eight listening port number pairs.

If you execute the https listen-port or listen-port command multiple times with the same Web caching listening port number or Web server caching listening port number, the most recent configuration takes effect.

Make sure the specified TCP port numbers are not being used or will be used by any other services on the device. To display TCP port numbers in use, execute the display tcp verbose command.

Prerequisites

Before you specify listening port numbers, you must complete the following tasks:

·     Configure an IP address object group. For more information about the IP address object group feature, see object group configuration in Security Configuration Guide.

·     Disable Web caching. After you complete the configuration, enable Web caching again.

Procedure

1.     Enter system view.

system-view

2.     Enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Specify listening port numbers.

¡     Specify HTTP listening port numbers.

listen-port port-number [ server-port server-port-number ]

¡     Specify HTTPS listening port numbers.

https listen-port port-number [ server-port server-port-number ]

Configuring Web cache file storage parameters

About this task

Perform this task to specify the primary Web cache directory or limit the total size of Web cache files.

Restrictions and guidelines

The Web cache directory for a Web cache view must reside on the same slot as the Web view.

Before specifying a Web cache directory, make sure all files in the upper-level directory are using a different name than the Web cache directory or have a file extension.

Make sure the storage medium where the Web cache directory resides has sufficient storage space. The directory typically needs a storage space of over 1 GB.

Prerequisites

Before you configuring Web cache file storage parameters, disable Web caching. After you complete the configuration, enable Web caching again.

Procedure

1.     Enter system view.

system-view

2.     Enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Set the primary Web cache directory.

file-directory directory

By default, the primary Web cache directory is not set.

4.     (Optional.) Set the maximum total size of Web cache files.

cache-limit size

By default, the maximum total size of Web cache files is 4 GB.

The maximum total size for Web cache files must be smaller than the maximum storage space size in the working directory.

Configuring extended Web caching features

Configuring traffic direction channels for Web cache dual gateways

About this task

Perform this task in the Web Cache dual gateways scenario. As shown in Figure 2, gateways Device A and Device B provide the Web Cache service for the user through the switch, and equal cost paths exist on both the uplink and downlink for Web cache. If the uplink and downlink traffic forwarding paths are not the same, the uplink traffic and downlink traffic will be forwarded to different gateways for processing, for example, the user uplink traffic passes Device A and the downlink traffic for the user passes Device B. Device B does not have a record for the user and therefore cannot forward the downlink traffic to the user and the user cannot access the requested Web resources as a result.

 

 

NOTE:

In the Web cache dual gateway scenario, the uplink traffic refers to the HTTP/HTTPS requests sent from user hosts to Web servers, and the downlink traffic refers to the HTTP/HTTP responses sent from Web servers to user hosts. The traffic direction channel between the gateway devices is a direct physical link or a GRE tunnel, which ensures the IP connectivity between the gateways.

 

Figure 2 User failure to access Web resources

 

As shown in Figure 3, on Device B, you can configure a traffic direction channel with the peer gateway (Device A). If Device B receives Web cache downlink traffic for a user that it cannot find, it forwards the downlink traffic to the peer gateway through the specified channel interface, so the peer gateway can provide Web resources for the user correctly.

Figure 3 Traffic direction channel between gateways

 

Restrictions and guidelines

When you execute the dual-gateway-channel command, make sure the specified IPv4 address of the peer gateway is reachable, and in the routing table, the outgoing interface for this IPv4 address is the channel interface specified in this command.

You can use the dual-gateway-channel command to configure multiple traffic direction channels in multiple VPN instances. If you execute this command for the same VPN instance or for the public network multiple times, the most recent configuration takes effect.

Prerequisites

Before you configure a channel for traffic direction with the peer gateway, complete the following tasks:

·     Establish the channel between the gateways to ensure that the downlink traffic can be sent to the peer gateway through the channel.

·     Disable the Web cache feature.

After you configure the channel, enable the Web cache feature again.

Procedure

1.     Enter system view.

system-view

2.     Create a Web cache and enter its view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Configure a channel for traffic direction with the peer gateway.

dual-gateway-channel [ vpn-instance vpn-instance-name ] interface interface-type interface-number peer ipv4-address

By default, no channels are configured for traffic direction with the peer gateway.

Enabling Web caching for files in QueryString of a URL

About this task

By default, Web caching does not cache files in QueryString of a URL. After you configure this feature, Web caching can cache the files and it determines whether to cache the files according to other file filtering rules.

Procedure

1.     Enter system view.

system-view

2.     Enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Enable Web caching to cache files in QueryString of a URL.

querystring-file-cache enable

By default, Web caching does not cache files in QueryString of a URL.

Configuring Web caching to ignore the specified HTTP/HTTPS response headers

About this task

The HTTP/HTTPS response header type affects Web caching as follows:

·     If the HTTP/HTTPS response has a Cache-Control header, whether Web caching caches the requested Web resources depends on the instructions in the header.

·     If the HTTP/HTTPS response has a Set-Cookie header, Web caching does not cache the requested Web resources.

·     If the HTTP/HTTPS response has a Vary header, whether Web caching caches the requested Web resources depends on the value for the Vary field.

To make sure Web caching caches the requested Web resources, configure Web caching to ignore the specified HTTP/HTTPS response headers.

Procedure

1.     Enter system view.

system-view

2.     Enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Configure Web caching to ignore the specified HTTP/HTTPS response headers.

cache-ignore { cache-control | set-cookie | vary } *

By default, whether Web caching caches Web resources is affected by the HTTP/HTTPS response header type.

Enabling Web caching

Restrictions and guidelines

Before enabling Web caching, you must configure the types of the webpage files to be cached and the primary Web cache directory.

Web caching will restart in one of the following situations:

·     When HTTP-based Web caching is configured, enable HTTPS-based Web caching.

·     When HTTPS-based Web caching is configured, enable HTTP-based Web caching.

·     When both HTTP-based and HTTPS-based Web caching are configured, disable HTTP-based or HTTPS-based Web caching.

When the device enabled with HTTPS-based Web caching attempts to cache Web resources accessed by a user through HTTPS, the user will be prompted with a certificate warning. Because the certificate of the device is a private CA-issued digital certificate, it cannot pass the verification of the user host. To resolve this issue, the user can export the device's CA root certificate file (webcache_cacert.crt) from the Web caching working directory and import it to the trusted certificate authorities store. Then, the device' certificate can pass the verification of the user host so the user will not be prompted with the certificate warning.

Procedure

1.     Enter system view.

system-view

2.     Enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Enable Web caching. Choose the options to configure as needed:

¡     Enable HTTP-based Web caching.

http enable

By default, HTTP-based Web caching is disabled.

¡     Enable HTTPS-based Web caching.

https enable

By default, HTTPS-based Web caching is disabled.

Configuring Web caching backup

Restrictions and guidelines

Make sure the storage medium where the Web cache directory resides has sufficient storage space. The Web caching feature saves its operation data and the Web content to be cached to files in the directory. The directory typically needs a storage space of over 1 GB.

The backup Web cache directory for a Web cache view must reside on the backup slot.

Before specifying a Web cache directory, make sure all files in the upper-level directory are using a different name than the Web cache directory or have a file extension.

Procedure

1.     Enter system view.

system-view

2.     Enter Web cache view.

In standalone mode:

web-cache slot slot-number

In IRF mode:

web-cache chassis chassis-number slot slot-number

3.     Specify a backup Web caching slot.

In standalone mode:

backup slot slot-number

In IRF mode:

backup chassis chassis-number slot slot-number

By default, the backup Web caching slot is not set.

4.     Set the backup Web cache directory.

file-directory directory

By default, the backup Web cache directory is not set.

After the backup Web cache directory is created, the device will not synchronize cache files under the primary directory to the backup directory.

Display and maintenance commands for Web caching

Execute the display command in any view.

 

Task

Command

Display Web caching information.

display web-cache [ history [ last { day | 30-days | 365-days | hour | minute | week } | verbose ] ]

Display information about files cached by Web caching.

display web-cache cached-data [ domain-name domain-name ]

Display the address list of Web servers from which the device does not cache data.

display web-cache deny-list { ipv4 | ipv6 } [ aged-ip ]

Web caching configuration examples (in standalone mode)

Example: Configuring HTTP-based Web caching

Network configuration

As shown in Figure 4, Servers A, B, and C are HTTP servers and they listen for HTTP packets on port numbers 8001, 8002, and 80, respectively. Configure HTTP-based Web caching and Web caching backup on the device to cache Web content from the HTTP servers.

Figure 4 Network diagram

 

Prerequisites

# Configure IP addresses for interfaces and make sure the device can reach the HTTP servers. (Details not shown.)

Procedure

1.     Create and enter Web cache view.

<Device> system-view

[Device] web-cache slot 1

2.     Configure Web caching parameters:

# Set the primary Web cache directory to #flash:/webcache.

[Device-web-cache-slot1] file-directory slot1#flash:/webcache

# Set the port number to 4001 for Web caching to listen for HTTP packets destined for Web server A that uses listening port number 8001.

[Device-web-cache-slot1] listen-port 4001 server-port 8001

# Set the port number to 4002 for Web caching to listen for HTTP packets destined for Web server B that uses listening port number 8002.

[Device-web-cache-slot1] listen-port 4002 server-port 8002

# Set the port number to 4003 for Web caching to listen for HTTP packets destined for Web server C that uses the listening port number 80.

[Device-web-cache-slot1] listen-port 4003

# Set the maximum total size for Web cache files to 10 GB.

[Device-web-cache-slot1] cache-limit 10

# Specify the types of the files on webpages to be cached.

[Device-web-cache-slot1] cached-data doc docx

# Specify an extension of the webpage files to be cached.

[Device-web-cache-slot1] cached-extension-name cab

# Specify the backup Web caching slot.

[Device-web-cache-slot1] backup slot 2

# Set the backup Web caching directory.

[Device-web-cache-slot1] file-directory backup slot2#flash:/webcache2

3.     Enable HTTP-based Web caching.

[Device-web-cache-slot1] http enable

Verifying the configuration

# Display Web caching information after the host sends the first HTTP request to the Web servers.

[Device-web-cache-slot1] display web-cache

Capability information

  Cache path: slot1#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:                      0

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 3

 

...

 

Statistics for past 365 days

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:                      0

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 3

# Display Web caching information after the host sends the second HTTP request for the same content to the Web servers.

[Device-web-cache-slot1] display web-cache

Capability information

  Cache path: slot1#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       0

  Download size:                        0

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 0

 

...

 

Statistics for past 365 days

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              50.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 3

The Web caching statistics for the most recent one minute in the command output show the Web caching feature is operating correctly.

·     The value of the Miss count field in the command output from the first display command is 3. The value of the Hit count field in the command output from the second display command is 3. The second HTTP request hits the Web cache.

·     The value of the Download size field in the command output from the second display command is 0. The value of the Bandwidth saved field in the command output from the second display command is 3.3 Mbps. This indicates that no Web data was downloaded from the Web server to the device after the device sent the second HTTP request.

# Display Web caching information after slot 1 fails.

[Device-web-cache-slot1] display web-cache

Capability information

  Cache path: slot2#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       0

  Download size:                        0

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 0

 

...

 

Statistics for past 365 days

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              50.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 3

The output shows that the Web caching directory has changed to the backup directory.

Example: Configuring HTTPS-based Web caching

Network configuration

As shown in Figure 5, Servers A, B, and C are HTTPS servers and they listen for HTTPS packets on port numbers 8001, 8002, and 443, respectively. Configure HTTPS-based Web caching and Web caching backup on the device to cache Web content from the HTTPS servers.

Figure 5 Network diagram

 

Prerequisites

# Configure IP addresses for interfaces and make sure the device can reach the HTTPS servers. (Details not shown.)

Procedure

1.     Create and enter Web cache view.

<Device> system-view

[Device] web-cache slot 1

2.     Configure Web caching parameters:

# Set the primary Web cache directory to #flash:/webcache.

[Device-web-cache-slot1] file-directory slot1#flash:/webcache

# Set the port number to 4001 for Web caching to listen for HTTPS packets destined for Web server A that uses listening port number 8001.

[Device-web-cache-slot1] https listen-port 4001 server-port 8001

# Set the port number to 4002 for Web caching to listen for HTTPS packets destined for Web server B that uses listening port number 8002.

[Device-web-cache-slot1] https listen-port 4002 server-port 8002

# Set the port number to 4003 for Web caching to listen for HTTPS packets destined for Web server C that uses the listening port number 443.

[Device-web-cache-slot1] https listen-port 4003

# Set the maximum total size for Web cache files to 10 GB.

[Device-web-cache-slot1] cache-limit 10

# Specify the types of the files on webpages to be cached.

[Device-web-cache-slot1] cached-data doc docx

# Specify an extension of the webpage files to be cached.

[Device-web-cache-slot1] cached-extension-name cab

# Specify the backup Web caching slot.

[Device-web-cache-slot1] backup slot 2

# Set the backup Web caching directory.

[Device-web-cache-slot1] file-directory backup slot2#flash:/webcache2

3.     Enable HTTPS-based Web caching.

[Device-web-cache-slot1] https enable

Verifying the configuration

# Display Web caching information after the host sends the first HTTPS request to the Web servers.

[Device-web-cache-slot1] display web-cache

Capability information

  Cache path: slot1#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:                      0

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 3

 

...

 

Statistics for past 365 days

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:                      0

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 3

# Display Web caching information after the host sends the second HTTP request for the same content to the Web servers.

[Device-web-cache-slot1] display web-cache

Capability information

  Cache path: slot1#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       0

  Download size:                        0

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 0

 

...

 

Statistics for past 365 days

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              50.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 3

The Web caching statistics for the most recent one minute in the command output show the Web caching feature is operating correctly.

·     The value of the Miss count field in the command output from the first display command is 1. The value of the Hit count field in the command output from the second display command is 1. The second HTTP request hits the Web cache.

·     The value of the Download size field in the command output from the second display command is 0. The value of the Bandwidth saved field in the command output from the second display command is 3.3 Mbps. This indicates that no Web data was downloaded from the Web server to the device after the device sent the second HTTPS request.

# Display Web caching information after slot 1 fails.

[Device-web-cache-slot1] display web-cache

Capability information

  Cache path: slot2#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       0

  Download size:                        0

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 0

 

...

 

Statistics for past 365 days

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              50.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 3

The output shows that the Web caching directory has changed to the backup directory.

Web caching configuration examples (in IRF mode)

Example: Configuring HTTP-based Web caching

Network configuration

As shown in Figure 6, Servers A, B, and C are HTTP servers and they listen for HTTP packets on port numbers 8001, 8002, and 80, respectively. Configure HTTP-based Web caching and Web caching backup on the device to cache Web content from the HTTP servers.

Figure 6 Network diagram

 

Prerequisites

# Configure IP addresses for interfaces and make sure the device can reach the HTTP servers. (Details not shown.)

Procedure

1.     Create and enter Web cache view.

<Device> system-view

[Device] web-cache chassis 1 slot 1

2.     Configure Web caching parameters:

# Set the primary Web cache directory to #flash:/webcache.

[Device-web-cache-chassis1-slot1] file-directory chassis1#slot1#flash:/webcache

# Set the port number to 4001 for Web caching to listen for HTTP packets destined for Web server A that uses listening port number 8001.

[Device-web-cache-chassis1-slot1] listen-port 4001 server-port 8001

# Set the port number to 4002 for Web caching to listen for HTTP packets destined for Web server B that uses listening port number 8002.

[Device-web-cache-chassis1-slot1] listen-port 4002 server-port 8002

# Set the port number to 4003 for Web caching to listen for HTTP packets destined for Web server C that uses the listening port number 80.

[Device-web-cache-chassis1-slot1] listen-port 4003

# Set the maximum total size for Web cache files to 10 GB.

[Device-web-cache-chassis1-slot1] cache-limit 10

# Specify the types of the files on webpages to be cached.

[Device-web-cache-chassis1-slot1] cached-data doc docx

# Specify an extension of the webpage files to be cached.

[Device-web-cache-chassis1-slot1] cached-extension-name cab

# Specify the backup Web caching slot.

[Device-web-cache-chassis1-slot1] backup chassis 2 slot 3

# Set the backup Web caching directory.

[Device-web-cache-chassis1-slot1] file-directory backup chassis2#slot3#flash:/webcache2

3.     Enable HTTP-based Web caching.

[Device-web-cache-chassis1-slot1] http enable

Verifying the configuration

# Display Web caching information after the host sends the first HTTP request to the Web servers.

[Device-web-cache-chassis1-slot1] display web-cache

Capability information

  Cache path: chassis1#slot1#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:                      0

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 3

 

...

 

Statistics for past 365 days

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:                      0

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 3

# Display Web caching information after the host sends the second HTTP request for the same content to the Web servers.

[Device-web-cache-chassis1-slot1] display web-cache

Capability information

  Cache path: chassis1#slot1#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       0

  Download size:                        0

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 0

 

...

 

Statistics for past 365 days

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              50.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 3

The Web caching statistics for the most recent one minute in the command output show the Web caching feature is operating correctly.

·     The value of the Miss count field in the command output from the first display command is 1. The value of the Hit count field in the command output from the second display command is 1. The second HTTP request hits the Web cache.

·     The value of the Download size field in the command output from the second display command is 0. The value of the Bandwidth saved field in the command output from the second display command is 3.3 Mbps. This indicates that no Web data was downloaded from the Web server to the device after the device sent the second HTTP request.

# Display Web caching information after slot 1 fails.

[Device-web-cache-chassis1-slot1] display web-cache

Capability information

  Cache path: chassis2#slot3#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       0

  Download size:                        0

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 0

 

...

 

Statistics for past 365 days

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              50.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 3

The output shows that the Web caching directory has changed to the backup directory.

Example: Configuring HTTPS-based Web caching

Network configuration

As shown in Figure 7, Servers A, B, and C are HTTPS servers and they listen for HTTPS packets on port numbers 8001, 8002, and 443, respectively. Configure HTTPS-based Web caching and Web caching backup on the device to cache Web content from the HTTPS servers.

Figure 7 Network diagram

 

Prerequisites

# Configure IP addresses for interfaces and make sure the device can reach the HTTPS servers. (Details not shown.)

Procedure

1.     Create and enter Web cache view.

<Device> system-view

[Device] web-cache chassis 1 slot 1

2.     Configure Web caching parameters:

# Set the primary Web cache directory to #flash:/webcache.

[Device-web-cache-chassis1-slot1] file-directory chassis1#slot1#flash:/webcache

# Set the port number to 4001 for Web caching to listen for HTTPS packets destined for Web server A that uses listening port number 8001.

[Device-web-cache-chassis1-slot1] https listen-port 4001 server-port 8001

# Set the port number to 4002 for Web caching to listen for HTTPS packets destined for Web server B that uses listening port number 8002.

[Device-web-cache-chassis1-slot1] https listen-port 4002 server-port 8002

# Set the port number to 4003 for Web caching to listen for HTTPS packets destined for Web server C that uses the listening port number 443.

[Device-web-cache-chassis1-slot1] https listen-port 4003

# Set the maximum total size for Web cache files to 10 GB.

[Device-web-cache-chassis1-slot1] cache-limit 10

# Specify the types of the files on webpages to be cached.

[Device-web-cache-chassis1-slot1] cached-data doc docx

# Specify an extension of the webpage files to be cached.

[Device-web-cache-chassis1-slot1] cached-extension-name cab

# Specify the backup Web caching slot.

[Device-web-cache-chassis1-slot1] backup chassis 2 slot 3

# Set the backup Web caching directory.

[Device-web-cache-chassis1-slot1] file-directory backup chassis2#slot3#flash:/webcache2

3.     Enable HTTPS-based Web caching.

[Device-web-cache-chassis1-slot1] https enable

Verifying the configuration

# Display Web caching information after the host sends the first HTTPS request to the Web servers.

[Device-web-cache-chassis1-slot1] display web-cache

Capability information

  Cache path: chassis1#slot1#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:                      0

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 3

 

...

 

Statistics for past 365 days

  ConnectTop: 4

  CacheTop: 25.0MB

  Bandwidth saved:                      0

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 0%

    Hit count: 0                     Miss count: 3

# Display Web caching information after the host sends the second HTTP request for the same content to the Web server.

[Device-web-cache-chassis1-slot1] display web-cache

Capability information

  Cache path: chassis1#slot1#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       0

  Download size:                        0

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 0

 

...

 

Statistics for past 365 days

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              50.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 3

The Web caching statistics for the most recent one minute in the command output show the Web caching feature is operating correctly.

·     The value of the Miss count field in the command output from the first display command is 1. The value of the Hit count field in the command output from the second display command is 1. The second HTTP request hits the Web cache.

·     The value of the Download size field in the command output from the second display command is 0. The value of the Bandwidth saved field in the command output from the second display command is 3.3 Mbps. This indicates that no Web data was downloaded from the Web server to the device after the device sent the second HTTPS request.

# Display Web caching information after slot 1 fails.

[Device-web-cache-chassis1-slot1] display web-cache

Capability information

  Cache path: chassis2#slot3#flash:/webcache/proxy/cache

  Max connections: 1022

  Max cache size: 10GB

 

Current state information

  Cache memory: 25.0MB

  Cache count: 3

 

Statistics for past 1 minute

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              25.0MB

  Download speed:                       0

  Download size:                        0

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 0

 

...

 

Statistics for past 365 days

  ConnectTop: 3

  CacheTop: 25.0MB

  Bandwidth saved:                      3.3Mbps

  Cached data transmission speed:       3.3Mbps

  Cached data transmitted:              50.0MB

  Download speed:                       3.3Mbps

  Download size:                        25.0MB

  CacheHitRate: 100%

    Hit count: 3                     Miss count: 3

The output shows that the Web caching directory has changed to the backup directory.

Troubleshooting Web caching

Web caching enabling failure

Symptom

Web caching failed to be enabled.

Analysis

The TCP port number specified for Web caching must belong to Web caching exclusively. If any other services on the device are using the same TCP port number, Web caching cannot be enabled.

Solution

To resolve the problem:

1.     Execute the display tcp verbose command to display TCP port numbers being used.

2.     Specify an unused TCP port number as the Web caching listening port number.

Web caching backup failure

Symptom

The device does not use the backup Web caching slot for Web caching after the primary Web caching slot reboots.

Analysis

If the storage medium of the backup Web caching slot is inaccessible or is not correctly configured, the Web caching service cannot be enabled on the backup Web caching slot.

Solution

To resolve the problem:

1.     Execute the dir command to display information about the backup Web caching slot and then make sure the storage medium of the directory is accessible.

For more information about the dir command, see file system management commands in Fundamentals Command Reference.

2.     If the issue persists, contact H3C Support.

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Intelligent Storage
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
  • Technical Blogs
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网