0

When serving the majority of my HTTPS pages, I have these HTTP headers included in the response (to the browser):

X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=77777777
Content-Type: text/html; charset=utf-8

The problem, they can be an overkill for small assets such as the file robots.txt. My robots.txt file now is sitting at 55 bytes (and 71 bytes when gzipped. pretty strange).

So to cut down on size, I removed the above header for robots.txt and sitemap.xml and for robots.txt the total network payload went down from about 1.2KB to 321 bytes (about an 80% savings).

So what I'd like to know is, are there short-form headers I could use to replace the headers above that would be compatible with today's web browsers?

I did think about injecting the headers into my HTML with meta-http equiv but some headers injected that way may come with a price I think.

Someone guide me. My end goal is to reduce the grand total payload (so people need to use much less data to load the web page).

mike_s
  • 139
  • 5

1 Answers1

1

What Maximillian wrote above is 100% spot on.

There’s no such thing as a "compressed format" for headers — you either use them, or you don’t.

If you want to lighten the load for your sitemap and robots, you can try using meta-http equiv, but some of your headers won’t work this way (like Strict-Transport-Security or X-Frame-Options), and others might not be as effective, like X-Content-Type-Options: nosniff, since it gets initialized when the page is already loading, not before.

And as already mentioned, this is not a ranking factor at all.

Evgeny Yudin
  • 582
  • 6
  • 18