411 🌐 HTTP

HTTP 411 Length Required

The server refuses a request with a body but no Content-Length header.

Seen on: Linux REST API

Meaning

Some servers and proxies won’t accept chunked transfer encoding for uploads and require the body size up front. It often shows up with empty POST requests or streaming uploads.

Common causes

  • POST/PUT with no body and no Content-Length: 0
  • Chunked uploads to a server/proxy that doesn’t support them
  • HTTP client library streaming a body of unknown length

⚡ Quick fix

  1. Send Content-Length: 0 for empty POSTs (curl: -d '')
  2. Buffer the body so the client can compute its length
  3. Upload to storage with a pre-signed URL that supports chunking

Detailed fix by platform

Linux

  1. curl:
    bash
    curl -X POST https://api.example.com/jobs/42/start -H 'Content-Length: 0'
    # or
    curl -X POST https://api.example.com/jobs/42/start -d ''

How to diagnose

  1. Headers — Is Content-Length or Transfer-Encoding: chunked sent?
  2. Body — Empty or streamed?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.