What is the HTTP Content-Type Header?


The Content-Type is a http header that defines the data type of the body of:

It specifies:

  • the mime type (mandatory)
  • and optionally the parameters of the mime:

The requested mime type of a request is specified by the accept header


Resources MIME type
HTML text/html
JSON text/json
XML text/xml

See the MIME page for more.



See header set on how to set an header.

Example with an html meta

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>


When the Content-Type is not specified, a user agent such as browser may obtain it through sniffing.

Many web servers supply incorrect Content-Type header fields with their HTTP responses. In order to be compatible with these servers, user agents consider the content of HTTP responses as well as the content-Type header fields when determining the effective media type of the response.

Configuration to prevent sniffing with the X-Content-Type-Options header

X-Content-Type-Options: nosniff

The specification document describes an algorithm for determining the effective media type of HTTP responses that balances security and compatibility considerations.

See also mime detection

Discover More
Cors Flowchart
Browser - Cross Origin Resource Sharing (CORS)

Cross-origin resource sharing (CORS) is a mechanism that: * allows a HTTP server * to control the cross-origin requests executed by a browser. In short, a HTTP server may allow or not to receive...
Browser - Cross-Origin Read Blocking (CORB)

Cross-Origin Read Blocking (CORB) is a security feature that prevents the contents of a resource from ever entering the memory of the renderer process memory based on its MIME type. The main motivation...
Chrome Devtool Xhr Fetch Request
Browser - XMLHttpRequest (XHR) API

The XMLHttpRequest is a web api function that performs an resource fetch with an Aysnchronous HTTP request XMLHttpRequestAPIAJAX programmingfetch API The status of an XHR request. Value Constant...
HTML - Character Set - Character Encoding (charset)

character sets (ie ) configuration in html with the meta tag to set the content-type HTTP header meta.charsetMeta Charset encoding TR/html5/infrastructure.htmlHTML5 - extractingcharacter...
HTML - Image (Img tag)

img is an fetch element that represents an image. An image in HTML can also be represented with a picture element that defines logically the same image but may have different physical image (different...
HTTP - Accept header

accept is a request header that specify the mimes type of the response body that are accepted by the client (ie browser) If no Accept header field is present, then it is assumed that the client accepts...
HTTP - Response

An HTTP response is a message sent from a server to a client in response to a request. It's the second part of a fetch, the first being a request. Example of a response that returns an HTML document...
How a resource is transferred in HTTP

How a resource is transferred from your web server to your browser. This article explains you this in details.
Devtool Tracking Cookie Identifier Counter
How does a tracking cookie work? A step by step example

This page shows you a basic example of a tracking ... cookie so that you can understand and implement the underlying mechanisms. These cookies are third-party cookie. A tracking cookie is also known...
Card Puncher Data Processing
Php - Form - HTTP Request/Response

Form and HTTP Fetch in php Phpdoes not support multiple form control with the same name. Even if it receive several values for the same name via a valid multipart-form-data, it will pass only the last...

Share this page:
Follow us:
Task Runner