HTTP Headers Tab
You
can use the HTTP Headers tab of the Properties window for a Web site to
enable content expiration on the site, to specify custom HTTP headers
that are returned by the server to requesting HTTP clients, to enable
and specify Internet Content Rating Association (ICRA) content ratings
on the server, and to specify additional MIME mappings for a particular
Web site.
Content Expiration
When you enable content
expiration on the site and a client browser requests a file from the
site, the HTTP headers returned by the server include information
regarding the expiration date of the site’s contents. The client can
then decide whether it needs to download a newer version of the file or
use an existing copy in the client browser cache.
Note
If your site contains
information that changes frequently (such as sports scores), you can
force clients to always retrieve fresh copies of files from the server
(and never use cached versions of these files) by selecting the Expire
Immediately option.
Custom HTTP Headers
This rather
esoteric feature allows you to specify custom HTTP headers that are
returned by the server to requesting HTTP clients. You might use this
option in certain situations involving firewalls or proxy servers to
enable or disable specific features during HTTP sessions. You can see
the dialog box in Figure 9.
Content Rating
This option is used to
enable and specify Internet Content Rating Association (ICRA) content
ratings on the server. These settings rate the site’s violence, sex,
nudity, and language content and are typically enabled on sites hosting
content unsuitable for viewing by minors.
MIME Types
The MIME type option
allows you to specify Web site–specific MIME mappings. Click MIME Types
and add, edit, or delete the mappings for the current site.
Custom Errors Tab
The Custom Errors tab
allows you to specify how your server will generate HTTP error messages
when users attempt to access the selected Web site. (See Figure 10.)
The HTTP specification
defines that the first header line returned by a Web server in response
to a request by a client will contain a number and associated message
indicating the status of the request. These three-digit numbers are
called HTTP status codes, and they fall within various ranges:
200 through 299 A successful HTTP transaction has occurred. (The most common status code is 200 OK.)
300 through 399 Redirection to another URL has occurred.
400 through 499 An error has occurred. Examples include the following:
400 Bad Request The server can’t understand the syntax of the request.
401 Unauthorized The user’s credentials don’t allow him or her to log on to the server.
403 Forbidden Access
is denied for some reason other than user credentials, such as the
client having a restricted IP address or needing to use SSL to access
the server.
404 File Not Found The file you’re trying to access doesn’t exist (or is misplaced or misnamed) on the server.
500 through 599 A server error has occurred or the requested feature isn’t implemented.
Instead of returning
bare HTTP status codes and their brief messages for the error codes (400
through 499), however, IIS is configured by default to use predefined
HTML pages that contain somewhat more information than the status codes
and messages. These “error files” are located in the
\%WinDir%\help\iishelp\common folder on the server, and you can modify
them if you want.
Alternatively, by selecting
one of these error files on the Custom Errors tab and clicking Edit
Properties, you can specify that the default HTTP status codes and
messages will be returned by the server when that error occurs, or that
any specified file located in either a local folder or a network share
will be returned when that error occurs. Companies commonly use this
feature to create error pages that contain elements such as the company
logo, the e-mail address of customer support, or even a search tool for
finding the page the client is trying to access.
Note
IIS uses more detailed
error messages than are included in the original HTTP specification. For
example, the HTTP error code 401—which in HTTP simply means
unauthorized—is represented in IIS by a group of codes spanning from
401.1 through 401.7, representing various reasons a server might deny a
user’s credentials.