5 Essential Website Security Headers to Check

Résumé

Pixel’s announcement explains how HTTP response headers control browser security, caching, and resource loading—even when a website looks perfect. It highlights five essential security headers, including HSTS, and shows how missing protections, disabled caching, and exposed server versions can create risks.

DEV Community

The Page Loads Fine — But Its Headers Are Telling a Different Story

Last month a client's site passed every check I could think of. The pages rendered fast. The design was clean. Lighthouse gave it a green score. Then their security auditor sent back a one-page report that read like a failing grade. Nothing on the page was broken. The problem was invisible — in the response headers. The site was missing four of the five security headers that browsers actually enforce, its pages were not being cached at all, and the server was happily announcing its exact software version to anyone who asked. I have checked headers on dozens of sites since, and the pattern repeats. Headers are the part of a response nobody looks at until something goes wrong. Here is what they are, what they control, and the five checks I run on every site now. What response headers actually are Every time a browser requests a page, the server sends two things back: the HTML you see, and a set of headers you do not. Headers are short key-value instructions that travel with the response. They tell the browser how to handle the page, how long to cache it, which resources it may load, and what to do when something looks suspicious. You can see them in any browser. Open DevTools, go to the Network tab, click a request, and look at the Response Headers section. Most developers have never opened that panel. That is the problem. The HTML is the visible half of a response. The headers are the operating instructions. A site can look perfect and still be shipping instructions that weaken its security, waste bandwidth, or confuse search engines. The five security headers that matter There are dozens of response headers, but five do most of the security work. If you check nothing else, check these. Strict-Transport-Security (HSTS) tells browsers to always use HTTPS for your site, even if a link or bookmark points to the plain HTTP version. Without it, a visitor who types your domain without the scheme can be downgraded to an unencrypted connection on the first request. With it, the browser refuses to make that mistake. Content-Security-Policy (CSP) controls which scripts, styles, and other resources a page is allowed to load, and from where. It is the strongest defence against cross-site scripting, because even if an attacker injects a script into your page, the browser will refuse to run it if the source is not on your approved list. X-Content-Type-Options with the value nosniff stops browsers from guessing a file's type. Without it, a browser can decide that a file your server called plain text is actually executable script — and run it. This is how some old MIME-sniffing attacks worked. X-Frame-Options (or the CSP frame-ancestors directive) stops other sites from embedding your pages in a frame. Without it, your login page can be framed inside an attacker's page in a clickjacking attack, where the visitor clicks something they cannot see. Referrer-Policy controls how much of your URL leaks to other sites when a visitor clicks an outbound link. A strict policy keeps internal paths and query strings out of the referrer header that other sites receive. None of these headers changes how a page looks. That is exactly why they get skipped. They are invisible work, and invisible work is the first thing cut under deadline pressure. The missing-header trap: everything works until it doesn't Here is the uncomfortable truth about security headers: a site missing all five will work perfectly. Pages load. Users log in. Nothing looks wrong. The protections these headers provide only matter when someone is actively attacking the site, or when an auditor checks. That is why I now treat a header check as part of every launch checklist, next to the SSL certificate and the sitemap. A missing HSTS header is not a cosmetic issue. It is an open door that only shows itself when someone walks through it. The same logic applies to the audit findings I see most often. The report does not say "your site is broken". It says "your site is unprotected". Those ar...
5 Essential Website Security Headers to Check
Powered by Readybot.io

Les dernières actus de Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …