How to determine the size of the HTTP response header

by Daniel Pham
Published: Updated:

Today, I’ll share with you how to determine the size of the HTTP response header.

The problem I encountered

Last week one of my systems encountered the following error.

When a user send a resquest POST, a 502 error occurs.

I checked the log on the server, I received the following log.

2019/04/02 09:23:33 [error] 2962#2962: *56257144 upstream sent too big header while reading response header from upstream, client:, server:, request: "POST /URI HTTP/2.0", upstream: "", host: "", referrer: ""

You sympathize when I have to hide IP and domain and URI information in the log above.

Why did such an error occur?

The size of the HTTP response header

According to a Chromium document (this is Chrome’s open source), normally the size of the HTTP header will be about 700-800 bytes.

Uncompressed request and response headers. Request headers today vary in size from ~200 bytes to over 2KB. As applications use more cookies and user agents expand features, typical header sizes of 700-800 bytes is common.

You can read more about it at the following link.

How to determine the size of the HTTP response header

We now know that header are usually 1KB in size. I checked my system, I’m leaving it to be 16KB. So why is it still failed.

Log reported that the header is too large. Now I will find a way to determine the size of the header.

Follow an article that I refer to. There is a command that can be used to count the number of bytes of the header.

curl -s -w \%{size_header} -o /dev/null

Now I try to run with the Google website.

determine the HTTP response header of Google sites
Determine the HTTP response header of Google sites.

You see the results are 775, 773 and 781 bytes.

Note: Results may vary by browser.

You can get different response headers depending on the client, i.e. the browser can request capabilities (gzip compression, keep-alives, etc.) that affect the headers in the response, so you cannot assume testing with browser and curl will give you the exact same headers from the server.


This article, just a personal experience of mine. It may be somewhat useful. You often consider as a reference channel.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.