Skip to content

HTTP security headers analyzer

Paste a response’s headers to check HSTS, Content Security Policy, framing, content type sniffing, referrer and cache settings.

Runs in your browser. Nothing you paste is sent to us.

Response headers

A sample response is filled in, with headers like Keycloak’s default realm settings. Paste the output of curl -sI https://your-host/.

This reads the text you paste. It does not connect to any site.

Findings

1 to improve 5 fine 4 notes

Strict-Transport-Security: Set
  • max-age is 365 days.
Content-Security-Policy: Set
  • No default-src. Anything without its own directive is allowed from anywhere. Start with default-src 'self'.
  • No script-src or default-src: scripts may come from anywhere.
  • No base-uri. An injected <base> tag can redirect relative script URLs; set base-uri 'self' or 'none'.
  • No form-action. It is not covered by default-src, so forms may post anywhere.
Framing: frame-ancestors is set
  • CSP frame-ancestors decides who may frame the page; browsers that support it ignore X-Frame-Options.
X-Content-Type-Options: nosniff
  • Browsers will not guess a different content type.
Referrer-Policy: no-referrer
  • Full URLs do not leak to other sites.
Cache-Control: no-store
  • Nothing is kept in caches.
Cross-Origin-Opener-Policy: Missing
  • Optional. same-origin isolates the page from windows it opens or that open it; it can break pop-up sign-in flows.
Permissions-Policy: Missing
  • Optional. It turns off browser features the page does not use, such as camera=() and geolocation=().
X-XSS-Protection: 1; mode=block
  • Current browsers have removed the XSS filter and ignore this header. The usual advice is 0 or no header, plus a CSP.
server: example-proxy
  • Names the software in use. Harmless alone, but it helps attackers pick known bugs; hide versions if you can.

How to use it

  1. Get the headers, for example with curl -sI https://your-host/ or from the browser’s network panel.
  2. Paste them.
  3. Read the findings, most serious first.
  4. Fix the headers at the server or proxy and check again.

What to know

Security headers tell the browser how to treat a page: use HTTPS only, which scripts to run, who may frame it, and what to send to other sites.

Keycloak sets several itself, per realm, under Realm settings, Security defenses: X-Frame-Options, Content-Security-Policy, X-Content-Type-Options, X-Robots-Tag, Referrer-Policy and Strict-Transport-Security. A reverse proxy can add or override others.

This tool only reads the text you paste. To see what a live site sends, fetch its headers yourself and paste them here.

What security headers are

Security headers are HTTP response headers that tell the browser how to treat a page: always use HTTPS, which scripts may run, who may show the page in a frame, how much of the URL to share with other sites, and whether to keep a copy in caches.

They cost nothing to send and close whole classes of attack, such as protocol downgrades, clickjacking and many cross-site scripting exploits. They matter most on pages that handle credentials, which makes a sign-in page the first place to get them right.

This analyzer reads a block of headers you paste and checks each one. It does not contact any site.

The headers that matter, at a glance

HeaderProtects againstA good value
Strict-Transport-SecurityDowngrade to HTTP, SSL strippingmax-age=31536000; includeSubDomains
Content-Security-PolicyCross-site scripting, data injection, framingA policy that limits scripts and sets frame-ancestors
X-Frame-OptionsClickjacking in older browsersDENY or SAMEORIGIN
X-Content-Type-OptionsMIME type sniffingnosniff
Referrer-PolicyLeaking URLs to other sitesno-referrer or strict-origin-when-cross-origin
Cache-ControlSensitive pages kept in cachesno-store on pages with credentials or personal data
Permissions-PolicyUnneeded browser featuresTurn off features the page does not use
Cross-Origin-Opener-PolicyCross-window attackssame-origin where pop-ups are not needed

Each header in more detail

What each header does, and what the analyzer looks for in it.

Strict-Transport-Security (HSTS)

HSTS, defined in RFC 6797, tells the browser to use only HTTPS for this host for max-age seconds, and to refuse to continue past certificate errors. After the first visit, a network attacker can no longer downgrade the connection to HTTP. includeSubDomains extends it to every subdomain; max-age=0 cancels it.

The preload flag asks to be included in the HSTS preload list built into browsers, which protects even the first visit. Submission requires a max-age of at least one year, includeSubDomains and a redirect from HTTP to HTTPS. Removal from the list is slow, so preload only when every subdomain is ready for HTTPS.

Content-Security-Policy (CSP)

CSP lists where a page may load scripts, styles, images, frames and other content from. A strict policy means that even if an attacker injects markup, their script does not run. It is the most powerful header and the hardest to get right, which is why it has its own CSP builder.

The analyzer checks the policy for the usual weaknesses: no default-src, scripts allowed with 'unsafe-inline' and no nonce or hash, 'unsafe-eval', scripts from any host, a missing object-src 'none', a missing base-uri, and a missing frame-ancestors.

X-Frame-Options and frame-ancestors

Both stop other sites from showing your page in a frame, which is how clickjacking works. frame-ancestors in CSP is the current standard and can list allowed sites; browsers that support it ignore X-Frame-Options. Sending both covers old and new browsers. ALLOW-FROM is not supported by current browsers.

X-Content-Type-Options

nosniff stops browsers from guessing a different content type than the server declared. Without it, a file uploaded as text could be treated as a script or stylesheet.

Referrer-Policy

Controls how much of the current URL is sent in the Referer header when a user follows a link or the page loads a resource. URLs on sign-in and callback pages can hold codes, state values or session details, so no-referrer there is reasonable. Browsers default to strict-origin-when-cross-origin when the header is absent.

Cache-Control

no-store tells browsers and shared caches not to keep a copy. Sign-in pages, token responses and pages with personal data should send it, so a shared computer’s back button or a proxy cannot reveal them later.

Headers you can drop

  • X-XSS-Protection: controlled a cross-site scripting filter that current browsers have removed. It does nothing in them, and in some old browsers the filter itself caused problems. Send 0 or leave it out, and rely on CSP.
  • Server and X-Powered-By with versions: not a vulnerability on their own, but they tell an attacker which known bugs to try. Remove versions where your server allows it.
  • Expect-CT: certificate transparency is now enforced by browsers without it, and the header is deprecated.

Security headers on a Keycloak sign-in page

Keycloak sends several security headers itself, configured per realm under Realm settings, Security defenses, Headers. The defaults are a sensible start:

Keycloak’s default realm security headers
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-src 'self'; frame-ancestors 'self'; object-src 'none';
X-Content-Type-Options: nosniff
X-Robots-Tag: none
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000; includeSubDomains
Referrer-Policy: no-referrer

This page loads with a sample response built from these defaults, so you can see what the analyzer makes of them: framing is limited, HSTS and nosniff are set, and the CSP is narrow but has no default-src or script-src, so it does not restrict scripts.

What to adjust

  • If another of your sites must embed Keycloak pages in a frame, change frame-ancestors to list that site, and keep X-Frame-Options consistent. Do not remove framing protection altogether.
  • Consider X-XSS-Protection: 0, the current advice.
  • HSTS reaches the browser only over HTTPS. Behind a reverse proxy, make sure the proxy does not strip it, or set it at the proxy.

Headers added at the proxy

A reverse proxy in front of Keycloak can add headers Keycloak does not send, such as Permissions-Policy or Cross-Origin-Opener-Policy. Avoid sending a second, different Content-Security-Policy: browsers enforce every CSP header they receive, so two policies combine to the stricter of both and can break the login pages.

What this analyzer does and does not do

  • It parses pasted headers, ignoring status lines and the < and > prefixes of curl -v output. If several responses are pasted, it checks the last one.
  • It checks HSTS, CSP, framing, nosniff, Referrer-Policy, Cache-Control, COOP and Permissions-Policy, and notes deprecated or revealing headers.
  • It sorts findings into things to fix, things to improve and notes.
  • It does not fetch your site. Browsers do not let one page read another site’s headers, and we do not want your URLs.
  • It checks only the response you paste. Different pages, such as the sign-in page and an API endpoint, can send different headers.

How to check your headers

  1. Fetch the headers of the page you care about, ideally a real sign-in page.
  2. Paste them into the analyzer.
  3. Fix the red findings first: missing HSTS, a CSP that allows any script, unprotected framing.
  4. Then improve the amber ones and read the notes.
  5. Change the headers at the application or proxy, fetch again and paste the new response.
Fetching headers (replace the host and realm with yours)
curl -sI https://auth.example.com/realms/acme/account
curl -sD - -o /dev/null https://auth.example.com/realms/acme/protocol/openid-connect/auth?client_id=account

Common mistakes

  • Setting HSTS on HTTP responses only. Browsers ignore it there; it must come over HTTPS.
  • A CSP with 'unsafe-inline' for scripts and no nonce, which looks protective but stops little.
  • Removing X-Frame-Options to allow one partner to frame a page, instead of listing the partner in frame-ancestors.
  • Headers set by the application but stripped or duplicated by a proxy or CDN.
  • Checking only the home page while the sign-in and API pages send different headers.
Questions

Frequently asked questions

Which security headers should every site have?

At least Strict-Transport-Security, X-Content-Type-Options: nosniff, framing protection through CSP frame-ancestors or X-Frame-Options, and a Content-Security-Policy. Sign-in pages should also send Referrer-Policy and Cache-Control: no-store.

What is a good HSTS max-age?

One year, 31536000 seconds, is the common value and the minimum for the browser preload list. Start shorter while testing, then raise it once every subdomain works over HTTPS.

Is X-XSS-Protection still needed?

No. Current browsers have removed the filter it controlled. The usual advice is to send 0 or omit it, and to use a Content Security Policy instead.

What is the difference between X-Frame-Options and frame-ancestors?

Both control who may frame a page. frame-ancestors is part of CSP, can list several allowed sites, and takes precedence in browsers that support it. X-Frame-Options covers older browsers.

How do I change security headers in Keycloak?

In the admin console, open Realm settings, Security defenses, Headers. Each realm has its own values for X-Frame-Options, Content-Security-Policy, HSTS and the others.

Can this tool scan my website?

No. It analyzes headers you paste, so nothing about your site is sent to us. Fetch the headers with curl or your browser’s network panel and paste them.

Why does my CSP not apply?

Common causes are a Report-Only header instead of the enforcing one, a proxy that strips the header, or a policy set in a meta tag, where some directives are ignored.

Do security headers affect SEO?

Not directly. HTTPS is a known ranking signal, and HSTS helps keep visitors on HTTPS, but most security headers simply protect users without changing rankings.

Where should security headers be set: in the app or the proxy?

Either works, but pick one place per header so they are not sent twice. Proxies are convenient for headers that apply to every response, such as HSTS; the application knows best for page-specific ones, such as CSP.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.