Appendix B: Configuring ETag and Max-Age in IIS

Actualizado: septiembre de 2009

Se aplica a: Windows Server 2008, Windows Vista

This appendix describes how to configure the ETag and Max-Age headers.

Configuring the ETag Header

For all versions of IIS, the ETag value for a returned object is based on the last modified file time. In addition to this generated value, the ETag field uses a configured metabase change number when generating the ETag value. To enable clustered nodes to return the same ETag value, the nodes in the cluster must be configured with a metabase change number of 0. In addition:

  • In IIS 7.0, the metabase change number of 0 is the default setting and cannot be modified.

  • In IIS 6.0, you must hard code the value 0 as the ETag change number by editing the metabase. For more information about modifying the ETag change number value in the metabase, see article 922703 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkId=164805).

  • In IIS 5.0, you must hard code the value 0 as the ETag change number by using Mdutil.exe. For more information about modifying the ETag change number value in the metabase, see article 922733 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkId=164806).

Configuring the Max-Age Header

The Max-age header defines the maximum time that a proxy server or client will cache a CRL or OCSP response before using a conditional GET to determine whether the object has changed. The following commands let you set, modify, and delete the Max-Age header setting.

To enable the Max-Age header

  1. Log on to the IIS 7.0 server as a member of the local Administrators group.

  2. Open an Administrative command prompt.

  3. At the command prompt, type cd \windows\system32\inetsrv, and then press ENTER.

  4. At the command prompt, type

    appcmd set config /section:httpProtocol /+customHeaders.[name='cacheControlHeader',value='max-age=604800']
    
    
  5. Close the command prompt.

To modify the Max-Age header

  1. Log on to the IIS 7.0 server as a member of the local Administrators group.

  2. Open an Administrative command prompt.

  3. At the command prompt, type cd \windows\system32\inetsrv, and then press ENTER.

  4. At the command prompt, type

    appcmd set config /section:httpProtocol /customHeaders.[name='cacheControlHeader'].value:max-age=86400
    
    
  5. Close the command prompt.

To view the current httpProtocol custom headers

  1. Log on to the IIS 7.0 server as a member of the local Administrators group.

  2. Open an Administrative command prompt.

  3. At the command prompt, type cd \windows\system32\inetsrv, and then press ENTER.

  4. At the command prompt, type

    appcmdlist config /section:httpProtocol 
    
    
  5. Close the command prompt.

noteNota
For more information about creating and modifying response headers from the command line and in the IIS Manager interface, see Configuring HTTP Response Headers in IIS 7.0 (http://go.microsoft.com/fwlink/?LinkId=155666).

Adiciones de comunidad

AGREGAR
Mostrar: