Http_Accept Headers
Accept – HTTP – MDN Web Docs
The Accept request HTTP header indicates which content types, expressed as MIME types, the client is able to understand. The server uses content negotiation to select one of the proposals and informs the client of the choice with the Content-Type response header. Browsers set required values for this header based on the context of the request. For example, a browser uses different values in a request when fetches a CSS stylesheet, image, video, or a script.
Header type
Request header
Forbidden header name
no
CORS-safelisted request header
yes, with the additional restriction that values can’t contain a
CORS-unsafe request header byte: 0x00-0x1F (except 0x09 (HT)),
“():<>? @[]{}, and 0x7F (DEL).
SyntaxAccept:
Accept:
Accept: */*
// Multiple types, weighted with the quality value syntax:
Accept: text/html, application/xhtml+xml, application/xml;q=0. 9, image/webp, */*;q=0. 8
Directives
A single, precise MIME type, like text/html.
A MIME type, but without a subtype. image/* corresponds to image/png, image/svg, image/gif, and other image types.
*/*
Any MIME type;q= (q-factor weighting)
A value used is placed in an order of preference expressed using a relative quality value called the weight.
ExamplesAccept: text/html
Accept: image/*
// General default
// Default for navigation requests
Accept: text/html, application/xhtml+xml, application/xml;q=0. 9, */*;q=0. 8
SpecificationsSpecificationHypertext Transfer Protocol (HTTP/1. 1): Semantics and Content (HTTP/1. 1)# ceptBrowser compatibilityBCD tables only load in the browserSee also
HTTP content negotiation
List of default Accept values
A header with the result of the content negotiation: Content-Type
Other similar headers: TE, Accept-Encoding, Accept-Language
Accept – HTTP – MDN Web Docs
The Accept request HTTP header indicates which content types, expressed as MIME types, the client is able to understand. The server uses content negotiation to select one of the proposals and informs the client of the choice with the Content-Type response header. Browsers set required values for this header based on the context of the request. For example, a browser uses different values in a request when fetches a CSS stylesheet, image, video, or a script.
Header type
Request header
Forbidden header name
no
CORS-safelisted request header
yes, with the additional restriction that values can’t contain a
CORS-unsafe request header byte: 0x00-0x1F (except 0x09 (HT)),
“():<>? @[]{}, and 0x7F (DEL).
SyntaxAccept:
Accept:
Accept: */*
// Multiple types, weighted with the quality value syntax:
Accept: text/html, application/xhtml+xml, application/xml;q=0. 9, image/webp, */*;q=0. 8
Directives
A single, precise MIME type, like text/html.
A MIME type, but without a subtype. image/* corresponds to image/png, image/svg, image/gif, and other image types.
*/*
Any MIME type;q= (q-factor weighting)
A value used is placed in an order of preference expressed using a relative quality value called the weight.
ExamplesAccept: text/html
Accept: image/*
// General default
// Default for navigation requests
Accept: text/html, application/xhtml+xml, application/xml;q=0. 9, */*;q=0. 8
SpecificationsSpecificationHypertext Transfer Protocol (HTTP/1. 1): Semantics and Content (HTTP/1. 1)# ceptBrowser compatibilityBCD tables only load in the browserSee also
HTTP content negotiation
List of default Accept values
A header with the result of the content negotiation: Content-Type
Other similar headers: TE, Accept-Encoding, Accept-Language
Response header – MDN Web Docs Glossary: Definitions of Web-related …
A response header is an HTTP header that can be used in an HTTP response and that doesn’t relate to the content of the message. Response headers, like Age, Location or Server are used to give a more detailed context of the response.
Not all headers appearing in a response are categorized as response headers by the specification. For example, the Content-Type header is a representation header indicating the original type of data in the body of the response message (prior to the encoding in the Content-Encoding representation header being applied). However, “conversationally” all headers are usually referred to as response headers in a response message.
The following shows a few response and representation headers after a GET request.
200 OK
Access-Control-Allow-Origin: *
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Mon, 18 Jul 2016 16:06:00 GMT
Etag: “c561c68d0ba92bbeb8b0f612a9199f722e3a621a”
Keep-Alive: timeout=5, max=997
Last-Modified: Mon, 18 Jul 2016 02:36:04 GMT
Server: Apache
Set-Cookie: mykey=myvalue; expires=Mon, 17-Jul-2017 16:06:00 GMT; Max-Age=31449600; Path=/; secure
Transfer-Encoding: chunked
Vary: Cookie, Accept-Encoding
X-Backend-Server:
X-Cache-Info: not cacheable; meta data too large
X-kuma-revision: 1085259
x-frame-options: DENY
See also
List of all HTTP headers
Glossary
Representation header
HTTP header
Response header
Fetch metadata response header
Request header
Frequently Asked Questions about http_accept headers
What is the HTTP Accept header?
The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Type response header.Aug 23, 2021
What is a response header?
A response header is an HTTP header that can be used in an HTTP response and that doesn’t relate to the content of the message. Response headers, like Age , Location or Server are used to give a more detailed context of the response. … The following shows a few response and representation headers after a GET request.
What does an Accept header do?
The Accept header is used to inform the server by the client that which content type is understandable by the client expressed as MIME-types. … If the Accept header is not present in the request, then the server assumes that the client accepts all types of media.Nov 7, 2019