Http Header Types
HTTP headers – MDN Web Docs
HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored.
Custom proprietary headers have historically been used with an X- prefix, but this convention was deprecated in June 2012 because of the inconveniences it caused when nonstandard fields became standard in RFC 6648; others are listed in an IANA registry, whose original content was defined in RFC 4229. IANA also maintains a registry of proposed new HTTP headers.
Headers can be grouped according to their contexts:
Request headers contain more information about the resource to be fetched, or about the client requesting the resource.
Response headers hold additional information about the response, like its location or about the server providing it.
Representation headers contain information about the body of the resource, like its MIME type, or encoding/compression applied.
Payload headers contain representation-independent information about payload data, including content length and the encoding used for transport.
Headers can also be grouped according to how proxies handle them:
Connection
Keep-Alive
Proxy-Authenticate
Proxy-Authorization
TE
Trailer
Transfer-Encoding
Upgrade (see also Protocol upgrade mechanism).
End-to-end headers
These headers must be transmitted to the final recipient of the message: the server for a request, or the client for a response. Intermediate proxies must retransmit these headers unmodified and caches must store them.
Hop-by-hop headers
These headers are meaningful only for a single transport-level connection, and must not be retransmitted by proxies or cached. Note that only hop-by-hop headers may be set using the Connection header.
Authentication
WWW-Authenticate
Defines the authentication method that should be used to access a resource.
Authorization
Contains the credentials to authenticate a user-agent with a server.
Defines the authentication method that should be used to access a resource behind a proxy server.
Contains the credentials to authenticate a user agent with a proxy server.
Caching
Age
The time, in seconds, that the object has been in a proxy cache.
Cache-Control
Directives for caching mechanisms in both requests and responses.
Clear-Site-Data
Clears browsing data (e. g. cookies, storage, cache) associated with the requesting website.
Expires
The date/time after which the response is considered stale.
Pragma
Implementation-specific header that may have various effects anywhere along the request-response chain. Used for backwards compatibility with HTTP/1. 0 caches where the Cache-Control header is not yet present.
Warning
General warning information about possible problems.
Client hintsHTTP Client hints are a set of request headers that provide useful information about the client such as device type and network conditions, and allow servers to optimize what is served for those conditions.
Servers proactively requests the client hint headers they are interested in from the client using Accept-CH. The client may then choose to include the requested headers in subsequent requests.
Accept-CH
Servers can advertise support for Client Hints using the Accept-CH header field or an equivalent HTML element with -equiv attribute.
Accept-CH-Lifetime
Servers can ask the client to remember the set of Client Hints that the server supports for a specified period of time, to enable delivery of Client Hints on subsequent requests to the server’s origin.
The different categories of client hints are listed client hints
Content-DPR
Response header used to confirm the image device to pixel ratio in requests where the DPR client hint was used to select an image resource.
Device-Memory
Approximate amount of available client RAM memory. This is part of the Device Memory API.
DPR
Client device pixel ratio (DPR), which is the number of physical device pixels corresponding to every CSS pixel.
Viewport-Width
A number that indicates the layout viewport width in CSS pixels. The provided pixel value is a number rounded to the smallest following integer (i. e. ceiling value).
Width
The Width request header field is a number that indicates the desired resource width in physical pixels (i. intrinsic size of an image).
Network client hintsNetwork client hints allow a server to choose what information is sent based on the user choice and network bandwidth and latency.
Downlink
Approximate bandwidth of the client’s connection to the server, in Mbps. This is part of the Network Information API.
ECT
The effective connection type (“network profile”) that best matches the connection’s latency and bandwidth. This is part of the Network Information API.
RTT
Application layer round trip time (RTT) in miliseconds, which includes the server processing time. This is part of the Network Information API.
Save-Data
A boolean that indicates the user agent’s preference for reduced data usage.
Conditionals
Last-Modified
The last modification date of the resource, used to compare several versions of the same resource. It is less accurate than ETag, but easier to calculate in some environments. Conditional requests using If-Modified-Since and If-Unmodified-Since use this value to change the behavior of the request.
ETag
A unique string identifying the version of the resource. Conditional requests using If-Match and If-None-Match use this value to change the behavior of the request.
If-Match
Makes the request conditional, and applies the method only if the stored resource matches one of the given ETags.
If-None-Match
Makes the request conditional, and applies the method only if the stored resource doesn’t match any of the given ETags. This is used to update caches (for safe requests), or to prevent uploading a new resource when one already exists.
If-Modified-Since
Makes the request conditional, and expects the resource to be transmitted only if it has been modified after the given date. This is used to transmit data only when the cache is out of date.
If-Unmodified-Since
Makes the request conditional, and expects the resource to be transmitted only if it has not been modified after the given date. This ensures the coherence of a new fragment of a specific range with previous ones, or to implement an optimistic concurrency control system when modifying existing documents.
Vary
Determines how to match request headers to decide whether a cached response can be used rather than requesting a fresh one from the origin server.
Connection management
Controls whether the network connection stays open after the current transaction finishes.
Controls how long a persistent connection should stay open.
Content negotiationContent negotiation headers.
Accept
Informs the server about the types of data that can be sent back.
Accept-Encoding
The encoding algorithm, usually a compression algorithm, that can be used on the resource sent back.
Accept-Language
Informs the server about the human language the server is expected to send back. This is a hint and is not necessarily under the full control of the user: the server should always pay attention not to override an explicit user choice (like selecting a language from a dropdown).
Controls
Expect
Indicates expectations that need to be fulfilled by the server to properly handle the request.
Max-Forwards
TBD
CookiesCORSDownloads
Content-Disposition
Indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a “Save As” dialog.
Message body information
Content-Length
The size of the resource, in decimal number of bytes.
Content-Type
Indicates the media type of the resource.
Content-Encoding
Used to specify the compression algorithm.
Content-Language
Describes the human language(s) intended for the audience, so that it allows a user to differentiate according to the users’ own preferred language.
Content-Location
Indicates an alternate location for the returned data.
Proxies
Forwarded
Contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request.
X-Forwarded-For
Identifies the originating IP addresses of a client connecting to a web server through an HTTP proxy or a load balancer.
X-Forwarded-Host
Identifies the original host requested that a client used to connect to your proxy or load balancer.
X-Forwarded-Proto
Identifies the protocol (HTTP or HTTPS) that a client used to connect to your proxy or load balancer.
Via
Added by proxies, both forward and reverse proxies, and can appear in the request headers and the response headers.
Redirects
Location
Indicates the URL to redirect a page to.
Request context
From
Contains an Internet email address for a human user who controls the requesting user agent.
Host
Specifies the domain name of the server (for virtual hosting), and (optionally) the TCP port number on which the server is listening.
Referer
The address of the previous web page from which a link to the currently requested page was followed.
Referrer-Policy
Governs which referrer information sent in the Referer header should be included with requests made.
User-Agent
Contains a characteristic string that allows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent. See also the Firefox user agent string reference.
Response context
Allow
Lists the set of HTTP request methods supported by a resource.
Server
Contains information about the software used by the origin server to handle the request.
Range requests
Accept-Ranges
Indicates if the server supports range requests, and if so in which unit the range can be expressed.
Range
Indicates the part of a document that the server should return.
If-Range
Creates a conditional range request that is only fulfilled if the given etag or date matches the remote resource. Used to prevent downloading two ranges from incompatible version of the resource.
Content-Range
Indicates where in a full body message a partial message belongs.
Security
Cross-Origin-Embedder-Policy (COEP)
Allows a server to declare an embedder policy for a given document.
Cross-Origin-Opener-Policy (COOP)
Prevents other domains from opening/controlling a window.
Cross-Origin-Resource-Policy (CORP)
Prevents other domains from reading the response of the resources to which this header is applied.
Content-Security-Policy (CSP)
Controls resources the user agent is allowed to load for a given page.
Content-Security-Policy-Report-Only
Allows web developers to experiment with policies by monitoring, but not enforcing, their effects. These violation reports consist of JSON documents sent via an HTTP POST request to the specified URI.
Expect-CT
Allows sites to opt in to reporting and/or enforcement of Certificate Transparency requirements, which prevents the use of misissued certificates for that site from going unnoticed. When a site enables the Expect-CT header, they are requesting that Chrome check that any certificate for that site appears in public CT logs.
Feature-Policy
Provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds.
Origin-Isolation
Provides a mechanism to allow web applications to isolate their origins.
Strict-Transport-Security (HSTS)
Force communication using HTTPS instead of HTTP.
Upgrade-Insecure-Requests
Sends a signal to the server expressing the client’s preference for an encrypted and authenticated response, and that it can successfully handle the upgrade-insecure-requests directive.
X-Content-Type-Options
Disables MIME sniffing and forces browser to use the type given in Content-Type.
X-Download-Options
The X-Download-Options HTTP header indicates that the browser (Internet Explorer) should not display the option to “Open” a file that has been downloaded from an application, to prevent phishing attacks as the file otherwise would gain access to execute in the context of the application. (Note: related MS Edge bug).
X-Frame-Options (XFO)
Indicates whether a browser should be allowed to render a page in a ,
HTTP – Header Fields – Tutorialspoint
HTTP header fields provide required information about the request or response, or about the object sent in the message body. There are four types of HTTP message headers:
General-header: These header fields have general applicability for both request and response messages.
Client Request-header: These header fields have applicability only for request messages.
Server Response-header: These header fields have applicability only for response messages.
Entity-header: These header fields define meta information about the entity-body or, if no body is present, about the resource identified by the request.
General Headers
Cache-Control
The Cache-Control general-header field is used to specify directives that MUST be obeyed by all the caching system. The syntax is as follows:
Cache-Control: cache-request-directive|cache-response-directive
An HTTP client or server can use the Cache-control general header to specify parameters for the cache or to request certain kinds of documents from the cache. The caching directives are specified in a comma-separated list. For example:
Cache-control: no-cache
The following table lists the important cache request directives that can be used by the client in its HTTP request:
S. N.
Cache Request Directive and Description
1
no-cacheA cache must not use the response to satisfy a subsequent request without successful revalidation with the origin server.
2
no-storeThe cache should not store anything about the client request or server response.
3
max-age = secondsIndicates that the client is willing to accept a response whose age is not greater than the specified time in seconds.
4
max-stale [ = seconds]Indicates that the client is willing to accept a response that has exceeded its expiration time. If seconds are given, it must not be expired by more than that time.
5
min-fresh = secondsIndicates that the client is willing to accept a response whose freshness lifetime is not less than its current age plus the specified time in seconds.
6
no-transformDoes not convert the entity-body.
7
only-if-cachedDoes not retrieve new data. The cache can send a document only if it is in the cache, and should not contact the origin-server to see if a newer copy exists.
The following important cache response directives that can be used by the server in its HTTP response:
Cache Response Directive and Description
publicIndicates that the response may be cached by any cache.
privateIndicates that all or part of the response message is intended for a single user and must not be cached by a shared cache.
no-cacheA cache must not use the response to satisfy a subsequent request without successful re-validation with the origin server.
must-revalidateThe cache must verify the status of the stale documents before using it and expired ones should not be used.
proxy-revalidateThe proxy-revalidate directive has the same meaning as the must- revalidate directive, except that it does not apply to non-shared user agent caches.
8
9
s-maxage = secondsThe maximum age specified by this directive overrides the maximum age specified by either the max-age directive or the Expires header. The s-maxage directive is always ignored by a private cache.
Connection
The Connection general-header field allows the sender to specify options that are desired for that particular connection and must not be communicated by proxies over further connections. Following is the simple syntax for using connection header:
Connection: “Connection”
HTTP/1. 1 defines the “close” connection option for the sender to signal that the connection will be closed after completion of the response. For example:
Connection: close
By default, HTTP 1. 1 uses persistent connections, where the connection does not automatically close after a transaction. HTTP 1. 0, on the other hand, does not have persistent connections by default. If a 1. 0 client wishes to use persistent connections, it uses the keep-alive parameter as follows:
Connection: keep-alive
Date
All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception. HTTP applications are allowed to use any of the following three representations of date/time stamps:
Sun, 06 Nov 1994 08:49:37 GMT; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994; ANSI C’s asctime() format
Here the first format is the most preferred one.
Pragma
The Pragma general-header field is used to include implementation specific directives that might apply to any recipient along the request/response chain. For example:
Pragma: no-cache
The only directive defined in HTTP/1. 0 is the no-cache directive and is maintained in HTTP 1. 1 for backward compatibility. No new Pragma directives will be defined in the future.
Trailer
The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding. Following is the syntax of Trailer header field:
Trailer: field-name
Message header fields listed in the Trailer header field must not include the following header fields:
Transfer-Encoding
Content-Length
The Transfer-Encoding general-header field indicates what type of transformation has been applied to the message body in order to safely transfer it between the sender and the recipient. This is not the same as content-encoding because transfer-encodings are a property of the message, not of the entity-body. The syntax of Transfer-Encoding header field is as follows:
Transfer-Encoding: chunked
All transfer-coding values are case-insensitive.
Upgrade
The Upgrade general-header allows the client to specify what additional communication protocols it supports and would like to use if the server finds it appropriate to switch protocols. For example:
Upgrade: HTTP/2. 0, SHTTP/1. 3, IRC/6. 9, RTA/x11
The Upgrade header field is intended to provide a simple mechanism for transition from HTTP/1. 1 to some other, incompatible protocol.
Via
The Via general-header must be used by gateways and proxies to indicate the intermediate protocols and recipients. For example, a request message could be sent from an HTTP/1. 0 user agent to an internal proxy code-named “fred”, which uses HTTP/1. 1 to forward the request to a public proxy at, which completes the request by forwarding it to the origin server at. The request received by would then have the following Via header field:
Via: 1. 0 fred, 1. 1 (Apache/1. 1)
Warning
The Warning general-header is used to carry additional information about the status or transformation of a message which might not be reflected in the message. A response may carry more than one Warning header.
Warning: warn-code SP warn-agent SP warn-text SP warn-date
Client Request Headers
Accept
The Accept request-header field can be used to specify certain media types which are acceptable for the response. The general syntax is as follows:
Accept: type/subtype [q=qvalue]
Multiple media types can be listed separated by commas and the optional qvalue represents an acceptable quality level for accept types on a scale of 0 to 1. Following is an example:
Accept: text/plain; q=0. 5, text/html, text/x-dvi; q=0. 8, text/x-c
This would be interpreted as text/html and text/x-c and are the preferred media types, but if they do not exist, then send the text/x-dvi entity, and if that does not exist, send the text/plain entity.
Accept-Charset
The Accept-Charset request-header field can be used to indicate what character sets are acceptable for the response. Following is the general syntax:
Accept-Charset: character_set [q=qvalue]
Multiple character sets can be listed separated by commas and the optional qvalue represents an acceptable quality level for nonpreferred character sets on a scale of 0 to 1. Following is an example:
Accept-Charset: iso-8859-5, unicode-1-1; q=0. 8
The special value “*”, if present in the Accept-Charset field, matches every character set and if no Accept-Charset header is present, the default is that any character set is acceptable.
Accept-Encoding
The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings that are acceptable in the response. The general syntax is:
Accept-Encoding: encoding types
Examples are as follows:
Accept-Encoding: compress, gzip
Accept-Encoding:
Accept-Encoding: *
Accept-Encoding: compress;q=0. 5, gzip;q=1. 0
Accept-Encoding: gzip;q=1. 0, identity; q=0. 5, *;q=0
Accept-Language
The Accept-Language request-header field is similar to Accept, but restricts the set of natural languages that are preferred as a response to the request. The general syntax is:
Accept-Language: language [q=qvalue]
Multiple languages can be listed separated by commas and the optional qvalue represents an acceptable quality level for non preferred languages on a scale of 0 to 1. Following is an example:
Accept-Language: da, en-gb;q=0. 8, en;q=0. 7
Authorization
The Authorization request-header field value consists of credentials containing the authentication information of the user agent for the realm of the resource being requested. The general syntax is:
Authorization: credentials
The HTTP/1. 0 specification defines the BASIC authorization scheme, where the authorization parameter is the string of username:password encoded in base 64. Following is an example:
Authorization: BASIC Z3Vlc3Q6Z3Vlc3QxMjM=
The value decodes into is guest:guest123 where guest is user ID and guest123 is the password.
Cookie
The Cookie request-header field value contains a name/value pair of information stored for that URL. Following is the general syntax:
Cookie: name=value
Multiple cookies can be specified separated by semicolons as follows:
Cookie: name1=value1;name2=value2;name3=value3
Expect
The Expect request-header field is used to indicate that a particular set of server behaviors is required by the client. The general syntax is:
Expect: 100-continue | expectation-extension
If a server receives a request containing an Expect field that includes an expectation-extension that it does not support, it must respond with a 417 (Expectation Failed) status.
From
The From request-header field contains an Internet e-mail address for the human user who controls the requesting user agent. Following is a simple example:
From:
This header field may be used for logging purposes and as a means for identifying the source of invalid or unwanted requests.
Host
The Host request-header field is used to specify the Internet host and the port number of the resource being requested. The general syntax is:
Host: “Host” “:” host [ “:” port];
A host without any trailing port information implies the default port, which is 80. For example, a request on the origin server for would be:
GET /pub/WWW/ HTTP/1. 1
Host:
If-Match
The If-Match request-header field is used with a method to make it conditional. This header requests the server to perform the requested method only if the given value in this tag matches the given entity tags represented by ETag. The general syntax is:
If-Match: entity-tag
An asterisk (*) matches any entity, and the transaction continues only if the entity exists. Following are possible examples:
If-Match: “xyzzy”
If-Match: “xyzzy”, “r2d2xxxx”, “c3piozzzz”
If-Match: *
If none of the entity tags match, or if “*” is given and no current entity exists, the server must not perform the requested method, and must return a 412 (Precondition Failed) response.
If-Modified-Since
The If-Modified-Since request-header field is used with a method to make it conditional. If the requested URL has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. The general syntax of if-modified-since is:
If-Modified-Since: HTTP-date
An example of the field is:
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
If-None-Match
The If-None-Match request-header field is used with a method to make it conditional. This header requests the server to perform the requested method only if one of the given value in this tag matches the given entity tags represented by ETag. The general syntax is:
If-None-Match: entity-tag
An asterisk (*) matches any entity, and the transaction continues only if the entity does not exist. Following are the possible examples:
If-None-Match: “xyzzy”
If-None-Match: “xyzzy”, “r2d2xxxx”, “c3piozzzz”
If-None-Match: *
If-Range
The If-Range request-header field can be used with a conditional GET to request only the portion of the entity that is missing, if it has not been changed, and the entire entity if it has been changed. The general syntax is as follows:
If-Range: entity-tag | HTTP-date
Either an entity tag or a date can be used to identify the partial entity already received. For example:
If-Range: Sat, 29 Oct 1994 19:43:31 GMT
Here if the document has not been modified since the given date, the server returns the byte range given by the Range header, otherwise it returns all of the new document.
If-Unmodified-Since
The If-Unmodified-Since request-header field is used with a method to make it conditional. The general syntax is:
If-Unmodified-Since: HTTP-date
If the requested resource has not been modified since the time specified in this field, the server should perform the requested operation as if the If-Unmodified-Since header were not present. For example:
If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
If the request results in anything other than a 2xx or 412 status, the If-Unmodified-Since header should be ignored.
Max-Forwards
The Max-Forwards request-header field provides a mechanism with the TRACE and OPTIONS methods to limit the number of proxies or gateways that can forward the request to the next inbound server. Here is the general syntax:
Max-Forwards: n
The Max-Forwards value is a decimal integer indicating the remaining number of times this request message may be forwarded. This is useful for debugging with the TRACE method, avoiding infinite loops. For example:
Max-Forwards: 5
The Max-Forwards header field may be ignored for all other methods defined in the HTTP specification.
Proxy-Authorization
The Proxy-Authorization request-header field allows the client to identify itself (or its user) to a proxy which requires authentication. Here is the general syntax:
Proxy-Authorization: credentials
The Proxy-Authorization field value consists of credentials containing the authentication information of the user agent for the proxy and/or realm of the resource being requested.
Range
The Range request-header field specifies the partial range(s) of the content requested from the document. The general syntax is:
Range: bytes-unit=first-byte-pos “-” [last-byte-pos]
The first-byte-pos value in a byte-range-spec gives the byte-offset of the first byte in a range. The last-byte-pos value gives the byte-offset of the last byte in the range; that is, the byte positions specified are inclusive. You can specify a byte-unit as bytes. Byte offsets start at zero. Some simple examples are as follows:
– The first 500 bytes
Range: bytes=0-499
– The second 500 bytes
Range: bytes=500-999
– The final 500 bytes
Range: bytes=-500
– The first and last bytes only
Range: bytes=0-0, -1
Multiple ranges can be listed, separated by commas. If the first digit in the comma-separated byte range(s) is missing, the range is assumed to count from the end of the document. If the second digit is missing, the range is byte n to the end of the document.
Referer
The Referer request-header field allows the client to specify the address (URI) of the resource from which the URL has been requested. The general syntax is as follows:
Referer: absoluteURI | relativeURI
Following is a simple example:
Referer:
If the field value is a relative URI, it should be interpreted relative to the Request-URI.
TE
The TE request-header field indicates what extension transfer-coding it is willing to accept in the response and whether or not it is willing to accept trailer fields in a chunked transfer-coding. Following is the general syntax:
TE: t-codings
The presence of the keyword “trailers” indicates that the client is willing to accept trailer fields in a chunked transfer-coding and it is specified either of the ways:
TE: deflate
TE:
TE: trailers, deflate;q=0. 5
If the TE field-value is empty or if no TE field is present, then only transfer-coding is chunked. A message with no transfer-coding is always acceptable.
User-Agent
The User-Agent request-header field contains information about the user agent originating the request. Following is the general syntax:
User-Agent: product | comment
Example:
User-Agent: Mozilla/4. 0 (compatible; MSIE5. 01; Windows NT)
Server Response Headers
Accept-Ranges
The Accept-Ranges response-header field allows the server to indicate its acceptance of range requests for a resource. The general syntax is:
Accept-Ranges: range-unit | none
For example a server that accepts byte-range requests may send:
Accept-Ranges: bytes
Servers that do not accept any kind of range request for a resource may send:
Accept-Ranges: none
This will advise the client not to attempt a range request.
Age
The Age response-header field conveys the sender’s estimate of the amount of time since the response (or its revalidation) was generated at the origin server. The general syntax is:
Age: delta-seconds
Age values are non-negative decimal integers, representing time in seconds. Following is a simple example:
Age: 1030
An HTTP/1. 1 server that includes a cache must include an Age header field in every response generated from its own cache.
ETag
The ETag response-header field provides the current value of the entity tag for the requested variant. The general syntax is:
ETag: entity-tag
Here are some simple examples:
ETag: “xyzzy”
ETag: W/”xyzzy”
ETag: “”
Location
The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion. The general syntax is:
Location: absoluteURI
Location:
The Content-Location header field differs from Location in that the Content-Location identifies the original location of the entity enclosed in the request.
Proxy-Authenticate
The Proxy-Authenticate response-header field must be included as a part of a 407 (Proxy Authentication Required) response. The general syntax is:
Proxy-Authenticate: challenge
Retry-After
The Retry-After response-header field can be used with a 503 (Service Unavailable) response to indicate how long the service is expected to be unavailable to the requesting client. The general syntax is:
Retry-After: HTTP-date | delta-seconds
Examples:
Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
Retry-After: 120
In the latter example, the delay is 2 minutes.
Server
The Server response-header field contains information about the software used by the origin server to handle the request. The general syntax is:
Server: product | comment
Server: Apache/2. 2. 14 (Win32)
If the response is being forwarded through a proxy, the proxy application must not modify the Server response-header.
Set-Cookie
The Set-Cookie response-header field contains a name/value pair of information to retain for this URL. The general syntax is:
Set-Cookie: NAME=VALUE; OPTIONS
Set-Cookie response header comprises the token Set-Cookie, followed by a comma-separated list of one or more cookies. Here are the possible values you can specify as options:
Options and Description
Comment=commentThis option can be used to specify any comment associated with the cookie.
Domain=domain The Domain attribute specifies the domain for which the cookie is valid.
Expires=Date-timeThe date the cookie will expire. If it is blank, the cookie will expire when the visitor quits the browser.
Path=pathThe Path attribute specifies the subset of URLs to which this cookie applies.
SecureIt instructs the user agent to return the cookie only under a secure connection.
Following is an example of a simple cookie header generated by the server:
Set-Cookie: name1=value1, name2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT
Vary
The Vary response-header field specifies that the entity has multiple sources and may therefore vary according to the specified list of request header(s). Following is the general syntax:
Vary: field-name
You can specify multiple headers separated by commas and a value of asterisk “*” signals that unspecified parameters are not limited to the request-headers. Following is a simple example:
Vary: Accept-Language, Accept-Encoding
Here field names are case-insensitive.
WWW-Authenticate
The WWW-Authenticate response-header field must be included in 401 (Unauthorized) response messages. The field value consists of at least one challenge that indicates the authentication scheme(s) and parameters applicable to the Request-URI. The general syntax is:
WWW-Authenticate: challenge
WWW- Authenticate field value might contain more than one challenge, or if more than one WWW-Authenticate header field is provided, the contents of a challenge itself can contain a comma-separated list of authentication parameters. Following is a simple example:
WWW-Authenticate: BASIC realm=”Admin”
Entity Headers
Allow
The Allow entity-header field lists the set of methods supported by the resource identified by the Request-URI. The general syntax is:
Allow: Method
You can specify multiple methods separated by commas. Following is a simple example:
Allow: GET, HEAD, PUT
This field cannot prevent a client from trying other methods.
Content-Encoding
The Content-Encoding entity-header field is used as a modifier to the media-type. The general syntax is:
Content-Encoding: content-coding
The content-coding is a characteristic of the entity identified by the Request-URI. Following is a simple example:
Content-Encoding: gzip
If the content-coding of an entity in a request message is not acceptable to the origin server, the server should respond with a status code of 415 (Unsupported Media Type).
Content-Language
The Content-Language entity-header field describes the natural language(s) of the intended audience for the enclosed entity. Following is the general syntax:
Content-Language: language-tag
Multiple languages may be listed for content that is intended for multiple audiences. Following is a simple example:
Content-Language: mi, en
The primary purpose of Content-Language is to allow a user to identify and differentiate entities according to the user’s own preferred language.
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent, had the request been a GET. The general syntax is:
Content-Length: DIGITS
Content-Length: 3495
Any Content-Length greater than or equal to zero is a valid value.
Content-Location
The Content-Location entity-header field may be used to supply the resource location for the entity enclosed in the message when that entity is accessible from a location separate from the requested resource’s URI. The general syntax is:
Content-Location: absoluteURI | relativeURI
Content-Location:
The value of Content-Location also defines the base URI for the entity.
Content-MD5
The Content-MD5 entity-header field may be used to supply an MD5 digest of the entity for checking the integrity
of the message upon receipt. The general syntax is:
Content-MD5: md5-digest using base64 of 128 bit MD5 digest as per RFC 1864
Content-MD5: 8c2d46911f3f5a326455f0ed7a8ed3b3
The MD5 digest is computed based on the content of the entity-body, including any content-coding that has been applied, but not including any transfer-encoding applied to the message-body.
Content-Range
The Content-Range entity-header field is sent with a partial entity-body to specify where in the full entity-body the partial body should be applied. The general syntax is:
Content-Range: bytes-unit SP first-byte-pos “-” last-byte-pos
Examples of byte-content-range-spec values, assuming that the entity contains a total of 1234 bytes:
– The first 500 bytes:
Content-Range: bytes 0-499/1234
– The second 500 bytes:
Content-Range: bytes 500-999/1234
– All except for the first 500 bytes:
Content-Range: bytes 500-1233/1234
– The last 500 bytes:
Content-Range: bytes 734-1233/1234
When an HTTP message includes the content of a single range, this content is transmitted with a Content-Range header, and a Content-Length header showing the number of bytes actually transferred. For example,
HTTP/1. 1 206 Partial content
Date: Wed, 15 Nov 1995 06:25:24 GMT
Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
Content-Range: bytes 21010-47021/47022
Content-Length: 26012
Content-Type: image/gif
Content-Type
The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent, had the request been a GET. The general syntax is:
Content-Type: media-type
Following is an example:
Content-Type: text/html; charset=ISO-8859-4
Expires
The Expires entity-header field gives the date/time after which the response is considered stale. The general syntax is:
Expires: HTTP-date
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Last-Modified
The Last-Modified entity-header field indicates the date and time at which the origin server believes the variant was last modified. The general syntax is:
Last-Modified: HTTP-date
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
HTTP headers | Content-Type – GeeksforGeeks
The Content-Type header is used to indicate the media type of the resource. The media type is a string sent along with the file indicating the format of the file. For example, for image file its media type will be like image/png or image/jpg, response, it tells about the type of returned content, to the client. The browser gets to know about the type of content it has to load on the machine. Every time its byte stream of the file that browsers receive, by the Content-type header, the browser will do something known as MIME sniffing i. e. it will inspect the stream it is receiving and then loads the data tention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML text/html; charset=UTF-8
Content-Type: multipart/form-data; boundary=something
Directives: There are three directives in the HTTP headers type: It holds the MIME (Multipurpose Internet Mail Extensions) type of the arset: It holds the character encoding standard. Charset is the encoding standard in which the data will be received by the undary: The boundary directive is required when there is multipart entities. Boundary is for multipart entities consisting of 70 characters from a set of characters known to be very robust through email gateways, and with no white space. Example: This example display how the images are read by browser with and without setting the Content-type:Now without using Content-type header we will get the content of the image in bytes, So it is not of any use to IHDRX?? ‘? iCCPsRGB IEC61966-2. 1(? u?? +DQ?? 3???????????? 63?? P???? H? U???? l?? RDJV??? 9oF?
$sn???? {N??? pZ?? ^? d? Z(p? E? ]?? h?? QEW? f?? T?? {, f??????????? z? aE?????? y??? 6%]>vkrA? ;S????? d?? M?
¡? 6??? `%????? &??? Q-Z? j???? BSZo? a??? }N?. _u {?? #?? N? g? {-bKGD??????? pHYs. #. #x?? vtIME? 4_? X
IDATx?? w? U?????? MB$?? $@@? 2t? “EDa??? “? C? *C???? Hq? ja?? w???????? L{?? }? }?? w? ;?? {??? {. 4,??? j???
q10?? _?? h2]`P?? :^? 5?? @? W? =???????? XY??? w.?? 9?? `z? 1?! V?? B???? XM~^? |? 1? qm??? (? h?? C? OV? js{e? +
L? b? {%? @`? +:sQ? @? Here, it is clearly visible that by applying the Content-type header information tells the browser, the type of response it is getting from the possible values of HTTP Content-type header:TypeValuesApplicationapplication/EDI-X12application/EDIFACTapplication/javascriptapplication/octet-streamapplication/oggapplication/pdfapplication/xhtml+xmlapplication/x-shockwave-flashapplication/jsonapplication/ld+jsonapplication/xmlapplication/zipapplication/x-www-form-urlencodedAudioaudio/mpegaudio/x-ms-wmaaudio/ (using by MHTML (HTML mail). )multipart/form-dataTexttext/csstext/csvtext/htmltext/javascript (obsolete)text/plaintext/xmlVideovideo/mpegvideo/mp4video/quicktimevideo/x-ms-wmvvideo/x-msvideovideo/x-flvvideo/webmVNDapplication/ Browsers: The browsers compatible with HTTP headers Content-type are listed below:Google ChromeInternet ExplorerFirefoxSafariOperaHTML is the foundation of webpages, is used for webpage development by structuring websites and web can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.
Frequently Asked Questions about http header types
What are different HTTP headers?
General-header: These header fields have general applicability for both request and response messages. … Client Request-header: These header fields have applicability only for request messages. Server Response-header: These header fields have applicability only for response messages.
What is Content-Type in HTTP header?
The Content-Type header is used to indicate the media type of the resource. The media type is a string sent along with the file indicating the format of the file. For example, for image file its media type will be like image/png or image/jpg, etc. In response, it tells about the type of returned content, to the client.Jul 29, 2021
What is a type header?
In responses, a Content-Type header tells the client what the content type of the returned content actually is. … In requests, (such as POST or PUT ), the client tells the server what type of data is actually sent.Aug 13, 2021