Skip to the content
Start free

HTTP headers

HTTP headers are short name and value lines sent with every web request and response, carrying information about the message, such as what type of file it is, how long it may be cached, where to redirect, or whether search engines may index it. You never see them on the page. Browsers, search bots and AI crawlers read them before anything else, so a wrong header can undo good content.

What are HTTP headers? #

Each time a browser or bot asks for a page, it sends a request. The server sends back a response. Both carry a block of headers above the body. MDN’s HTTP headers reference describes the format: a name, a colon, then the value, for example Allow: POST. The current rules for HTTP meaning are in RFC 9110, published in June 2022. It says header names are case-insensitive, so Content-Type and content-type are the same field. It also says all 3 major versions of HTTP rely on those same meanings.

What does a response look like? #

Here is a short, typical response for a web page:

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: max-age=600
Last-Modified: Mon, 23 Nov 2026 09:00:00 GMT
Strict-Transport-Security: max-age=31536000
X-Robots-Tag: noarchive

The first line holds the HTTP status code. Every line under it is a header.

Which headers matter most? #

MDN groups headers into request headers (about the thing being asked for, or the client asking), response headers (about the reply or the server) and representation headers (about the body, such as its type or compression). The ones a site owner meets most often:

Header Sent by What it does
Content-Type Server States the media type, such as text/html or image/webp
Location Server Gives the new address for a redirect
Cache-Control Both Tells browsers and caches how long a copy stays fresh
Last-Modified and ETag Server Let a client ask “has this changed?” instead of downloading again
Vary Server Says which request headers change the reply, so caches keep separate copies
X-Robots-Tag Server Gives indexing rules such as noindex, even for PDFs and images
Link Server Carries links in the header, the same meaning as an HTML link element
Strict-Transport-Security Server Forces the browser to use HTTPS on later visits
Content-Security-Policy Server Limits which scripts, styles and images a page may load
User-Agent Client Names the software making the request
Referer Client The page the visitor came from (the spelling is historic)

MDN also notes that the old habit of starting custom names with X- was deprecated in 2012, by RFC 6648. Older ones such as X-Robots-Tag and X-Content-Type-Options are still in wide use.

Search bots act on headers as well as HTML. 4 cases matter most:

  • Status and Location. Google’s status code guide treats a 301 or 308 as a strong signal that the new address should be used, and a 302 or 307 as a weak one. It says Googlebot generally follows up to 10 redirect hops. See 301 vs 302 redirect and redirect chain.
  • X-Robots-Tag. Google’s robots meta tag guide says the header is the way to keep files such as PDFs out of the index, because they cannot hold a meta tag. You can name one crawler, as in X-Robots-Tag: googlebot: nofollow. Read more on X-Robots-Tag and the meta robots tag.
  • Conditional requests. If a page has not changed, the server can answer 304 Not Modified with no body. Google’s guide says a 304 tells its systems the content is the same as last time. That saves your server and the bot work, which helps your crawl budget.
  • Link rel=canonical. A canonical hint can be sent in the Link header for files that are not HTML. See canonical tag.

Why do they matter for AI answers? #

AI crawlers such as GPTBot, ClaudeBot and PerplexityBot receive the same headers. A wrong Content-Type can make a bot treat a page as a download. A stray noindex in a header can keep a page out of results that AI search tools draw on. Headers are also how you tell who is calling: the User-Agent names the bot, and our verify AI bot tool checks whether that name is honest. More on user agents.

How does caching use headers? #

The web.dev guide to the HTTP cache explains the main Cache-Control values. no-cache means “check with the server before each use”, not “do not store”. no-store means never keep a copy. max-age sets how many seconds a copy stays fresh. For files with a version code in the name, such as style.x234dff.css, it suggests a max-age of 31536000 seconds, which is 1 year. When the file changes, the name changes, so visitors get the new one. See caching and edge cache.

Common mistakes #

  • A noindex header left over from a staging site. The page looks fine in the browser but never ranks. See staging site.
  • Caching HTML for a week. Visitors and bots keep seeing old prices.
  • Redirects through 3 or 4 hops. Each hop adds time and a chance to fail.
  • Wrong Content-Type on a sitemap or feed. Some readers will reject the file.
  • Missing security headers. No HSTS means the first visit can still be sent over plain HTTP. See HTTPS vs HTTP.

A worked example #

A small firm moves its price list from a web page to a PDF. A month later, the old PDF from 2024 still shows in Google above the new one. The fix is 2 headers. The old file answers with a 301 and a Location header pointing to the new PDF. The new PDF is sent with Content-Type: application/pdf and a correct Last-Modified date. Within a few crawls, the old address drops out and the new file takes its place.

How to check it #

Questions #

Are HTTP headers the same as the HTML head? #

No. The HTML head is part of the page. HTTP headers travel before the page, in the response itself.

Do header names care about capital letters? #

No. RFC 9110 says field names are case-insensitive.

Can I add headers on WordPress? #

Yes, through server settings, an .htaccess file or a plugin such as our security headers plugin.

Sources #

Updated 24 November 2026 by URSY.

Cite this page: HTTP headers. URSY. Updated 24 November 2026. https://ursy.com/wiki/http-headers/ · Section links

Tools for this

All 871 wiki entries, A to Z →