HTTP Headers
Want Repr Digest
The HTTP Want-Repr-Digest
request and response headers indicate a preference for the recipient to send a Repr-Digest
integrity header in messages associated with the request URI and representation metadata.
The headers include hashing algorithm preferences that the recipient can use in subsequent messages.
The preferences only serve as hints, and the recipient may ignore the algorithm choices or the integrity headers entirely.
Some implementations may send unsolicited Repr-Digest
headers without requiring a Want-Repr-Digest
header in a previous message.
Representation headers are a specific type of HTTP header that provide information about the representation of a resource. They do not block or restrict requests but serve as metadata to facilitate integrity verification and caching strategies.
Syntax
A comma-separated list of one or more hashing algorithms:
Want-Repr-Digest: <algorithm>=<preference>
Want-Repr-Digest: <algorithm>=<preference>, <algorithm2>=<preference2>, …, <algorithmN>=<preferenceN>
Directives
Directives
<algorithm>
- The specified algorithm is used to generate a digest of the representation.
Only two registered digest algorithms are considered secure:sha-512
andsha-256
Insecure (legacy) registered digest algorithms include:md5
,sha
(SHA-1),unixsum
,unixcksum
,adler
(ADLER32), andcrc32c
.
<preference>
- This is an integer value ranging from 0 to 9, where
0
indicates “not acceptable” and values from1
to9
represent increasing degrees of preference.
Unlike earlier drafts, the preference weighting is not specified using q quality values.
Example
This section provides examples of HTTP headers and discusses browser compatibility considerations.
Want-Repr-Digest: sha-512=8, sha-256=6, adler=0, sha=1
Want-Repr-Digest: sha-512=10, sha-256=1, md5=0
This header does not have a predefined browser implementation, so “browser compatibility” does not apply.
Developers can set and retrieve HTTP headers using fetch()
to enable application-specific behavior.
How to Modify Header using Requestly
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Want-Repr-Digest.
- In the “Header Value” field, enter the digest algorithm(s) you want the server to use (e.g., sha-256).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
- Save the rule.
Once set up, Requestly will inject the Want-Repr-Digest: sha-256 header into all matching requests, allowing you to test how your server handles and responds with representation digests appropriately.
You might need to modify the Want-Repr-Digest header to verify if your server generates and returns content digests correctly. This helps ensure data integrity and secure content delivery during development and testing.
Table of Contents
- No headings found.