Adding helpful context to the response

Information Headers

Preliminaries

This note describes the information-headers module and how it can provide contextual information to make standard HTTP status codes more meaningful.

Every HTTP response has a three-digit status code. Their meanings are defined in various IETF RFCs. Oftentimes a response code is too generic and provides insufficient context to know how to troubleshoot a problem. The server's information-headers modules can provide that context.

An information header is a HTTP response header that begins with "rw-". The value associated with the header contains two parts: V1, an actual value; and V2, an expected value.

For example, if the rw-no-acceptable-type header contains a value like "V1=text/xml; V2=text/html, application/javascript", it means that the browser asked for a resource with the MIME-type shown in the first variable, V1 "text/xml", but the server is configured to only provide resources with the MIME-types shown in the second variable, V2 "text/html, application/javascript".

Some information headers only contain a single value when that is more germane; and some headers are self-explanatory and completely omit any value.

Refer to the other notes in this series to learn what conditions trigger each of these information headers.

rw-bad-range
rw-blue-cache-add
rw-blue-cache-dependency
rw-blue-cache-hit
rw-blue-cache-stale
rw-blue-dir-deleted
rw-blue-file-deleted
rw-blue-invalid-option
rw-blue-dep-deleted
rw-blue-res-deleted
rw-blue-lnk-deleted
rw-blue-unsupported-method
rw-conditional-range-failed
rw-content-decoding
rw-content-decoding
rw-content-length-limit
rw-content-length-missing
rw-content-range
rw-content-type-mismatch
rw-content-type-missing
rw-content-type-not-supported
rw-counters-unknown-extension
rw-counters-internal-error
rw-encoding-cache-add
rw-encoding-cache-add
rw-encoding-cache-hit
rw-encoding-dir-deleted
rw-encoding-file-deleted
rw-forbidden
rw-header-not-allowed
rw-hostname
rw-if-match
rw-if-none-match
rw-if-unmodified-since
rw-ip-access
rw-language-not-acceptable
rw-language-not-configured
rw-method-not-allowed
rw-no-acceptable-type
rw-no-cache-control
rw-origin-not-allowed
rw-path
rw-range-units-not-supported
rw-rbac-expired
rw-rbac-forbidden
rw-rbac-forged
rw-rbac-internal-error
rw-rbac-missing-credentials
rw-rbac-no-matching-role
rw-rbac-no-resource-rule
rw-rbac-remote-address
rw-rbac-renewal
rw-rbac-unsupported-action
rw-rbac-unsupported-content-type
rw-rbac-unsupported-method
rw-rbac-unsupported-scheme
rw-referer-nopush
rw-request-dir-deleted
rw-request-file-deleted
rw-request-file-not-deleted
rw-resource-path-illegal
rw-resource-path-length
rw-router-missing-module
rw-user-agent-nopush
rw-user-agent-noserve

Configuration

Like all of the server's extra modules, the information-headers module is not enabled unless explicitly set to "on" in the modules section.

EBNF

SP ::= U+20
CR ::= U+0D
LEFT-CURLY-BRACKET ::= U+7B
RIGHT-CURLY-BRACKET ::= U+7D
module-name ::= 'information-headers'
named-module-entry ::= module-name SP ('on' | 'off') CR
modules-section ::= 'modules' SP LEFT-CURLY-BRACKET CR
named-module-entry*
RIGHT-CURLY-BRACKET CR

Cookbook

Example 1: Information headers enabled
server {
modules {
information-headers on
}
}

Review

Key points to remember:

  • It is recommended to keep this module turned on both during development and while in production.
  • There is no performance penalty and no known security issues with having this module on.
Read Write Tools icon

Smart tech

READ WRITE TOOLS

Read Write Hub icon

Templates & Content

READ WRITE HUB

BLUEPHRASE icon

Rediscover HTML

BLUE PHRASE

0

Adding helpful context to the response

🔗 🔎