Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. HTTP
  3. Reference
  4. Headers
  5. Content-Length

Content-Length header

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

The HTTPContent-Length header indicates the size, in bytes, of the message body sent to the recipient.

Content-Length is limited in that the message size must be known up front, before sending the headers, which is a problem when content is dynamically generated or streamed.

  • In HTTP/1.0, it is required.
  • In HTTP/1.1, it could be replaced withTransfer-Encoding: chunked for responses sent out in parts as its size is calculated.
  • In HTTP/2,Content-Length is redundant, because the content length may be inferred from DATA frames. It may still be included for backwards compatibility.
Header typeRequest header,Response header,Content header
Forbidden request headerYes
CORS-safelisted response headerYes

Syntax

http
Content-Length: <length>

Directives

<length>

The length in octets.

Specifications

Specification
HTTP Semantics
# field.content-length

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp