---
title: "Browser security headers · Agent Wranglers"
url: https://agentwranglers.se/playbook/application-security/browser-security-headers
parts: 19
tokens_total: 15293
updated: 2026-10-27
build: a2a6bdfed830
tokens: 2080
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Browser security headers

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Application security](https://agentwranglers.se/playbook/application-security.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

> HTTPS, a strict Content Security Policy, isolation headers, integrity checks and origin checks that keep the browser from turning against visitors.

These headers protect visitors in the browser. Send them from one place for every response, as [Send the security headers as one set](https://agentwranglers.se/playbook/application-security/browser-security-headers/header-set.md) says. Each of the other rules explains one header and its trade-offs.

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/application-security/browser-security-headers">Agent Wranglers application security playbook</a>`. In code you write, add a comment next to it with the same link.

## Required

- APS-23 [Make browsers always use HTTPS](https://agentwranglers.se/playbook/application-security/browser-security-headers/hsts.md) · 706 tokens · updated 2026-10-27
  Send `Strict-Transport-Security` so browsers always use HTTPS. Give it a long `max-age` (at least a year) and `includeSubDomains`, on HTTPS responses only.
- APS-28 [Refuse to be framed](https://agentwranglers.se/playbook/application-security/browser-security-headers/frame-ancestors.md) · 823 tokens · updated 2026-10-27
  Stop other sites from showing yours inside a frame. Use `frame-ancestors 'none'` (or a list) in the CSP, plus `X-Frame-Options` for older browsers.

## Recommended

- APS-100 [Send the security headers as one set](https://agentwranglers.se/playbook/application-security/browser-security-headers/header-set.md) · 1,306 tokens · updated 2026-10-27
  Set every browser security header in one middleware or server block that runs for every response, including errors, redirects, files and API answers. Test the whole set as one unit.
- APS-24 [Load nothing over plain HTTP](https://agentwranglers.se/playbook/application-security/browser-security-headers/mixed-content.md) · 632 tokens · updated 2026-10-27
  Load every file over HTTPS. Add `upgrade-insecure-requests` as a safety net.
- APS-25 [Allow only the scripts you wrote](https://agentwranglers.se/playbook/application-security/browser-security-headers/content-security-policy.md) · 1,337 tokens · updated 2026-10-27
  Send a strict Content Security Policy, a header that says which scripts may run. Allow scripts only by nonce or hash, with `'strict-dynamic'`, `object-src 'none'`, `base-uri 'none'` and no `unsafe-inline`.
- APS-26 [Collect reports of blocked content](https://agentwranglers.se/playbook/application-security/browser-security-headers/reporting-endpoints.md) · 1,079 tokens · updated 2026-10-27
  Name a place for browsers to send policy errors with `Reporting-Endpoints`. Log those reports without any personal data.
- APS-27 [Stop browsers guessing file types](https://agentwranglers.se/playbook/application-security/browser-security-headers/x-content-type-options.md) · 617 tokens · updated 2026-10-27
  Send `X-Content-Type-Options: nosniff` on every response, so browsers don't guess file types. Give every response its correct Content-Type.
- APS-29 [Refuse odd requests from other sites](https://agentwranglers.se/playbook/application-security/browser-security-headers/fetch-metadata.md) · 830 tokens · updated 2026-10-27
  Browsers send `Sec-Fetch-*` headers that say where a request came from. Use them to refuse cross-site requests that are not normal page visits.
- APS-30 [Keep other sites' windows apart](https://agentwranglers.se/playbook/application-security/browser-security-headers/cross-origin-isolation.md) · 781 tokens · updated 2026-10-27
  Send `Cross-Origin-Opener-Policy: same-origin` and a `Cross-Origin-Resource-Policy`. These keep other sites' windows and pages away from yours. Add COEP only if you need full isolation.
- APS-31 [Share less in the Referer header](https://agentwranglers.se/playbook/application-security/browser-security-headers/referrer-policy.md) · 718 tokens · updated 2026-10-27
  Keep `Referrer-Policy` at the browser default, `strict-origin-when-cross-origin`, or stricter. Send it on every response, so no framework default, meta tag or old browser loosens it.
- APS-32 [Switch off browser features you don't use](https://agentwranglers.se/playbook/application-security/browser-security-headers/permissions-policy.md) · 608 tokens · updated 2026-10-27
  Use `Permissions-Policy` to turn off every browser feature the site does not use. Allow the rest only for your own origin.
- APS-33 [Lock scripts to a known hash](https://agentwranglers.se/playbook/application-security/browser-security-headers/subresource-integrity.md) · 978 tokens · updated 2026-10-27
  Put an `integrity` hash, a fingerprint of the file, on every script and stylesheet. Let the browser refuse any script without one.
- APS-35 [Lock down risky DOM writes](https://agentwranglers.se/playbook/application-security/browser-security-headers/trusted-types.md) · 739 tokens · updated 2026-10-27
  Require Trusted Types in the CSP, so scripts can't write raw HTML into the page. Send every remaining case through one small named policy.
- APS-37 [Share data across sites on purpose](https://agentwranglers.se/playbook/application-security/browser-security-headers/strict-cors.md) · 641 tokens · updated 2026-10-27
  Allow other sites to read your API only from a fixed list of origins. Never copy the request's `Origin` into the reply when cookies are allowed.
- APS-38 [Check the origin of WebSocket connections](https://agentwranglers.se/playbook/application-security/browser-security-headers/websocket-origin.md) · 689 tokens · updated 2026-10-27
  Accept a WebSocket connection only from your own origins, and only after checking the user's login, as for any other request.
- APS-39 [Check the sender of every window message](https://agentwranglers.se/playbook/application-security/browser-security-headers/postmessage-origin.md) · 749 tokens · updated 2026-10-27
  When a page listens for messages from other windows or frames, accept only those from a fixed list of origins. Never send private data to the target origin `*`.
- APS-40 [Redirect only to your own pages](https://agentwranglers.se/playbook/application-security/browser-security-headers/block-open-redirects.md) · 787 tokens · updated 2026-10-27
  A redirect that takes its target from the address must only go to your own pages or an allow-list.

## Optional

- APS-34 [Send a hash of the body](https://agentwranglers.se/playbook/application-security/browser-security-headers/digest-fields.md) · 643 tokens · updated 2026-10-27
  Send a `Content-Digest`, a hash of the response body, on files clients download to verify, such as Markdown copies and downloads. RFC 9530 defines it.

## Avoid

- APS-36 [Sending the old XSS filter header](https://agentwranglers.se/playbook/application-security/browser-security-headers/x-xss-protection.md) · 630 tokens · updated 2026-10-27
  Do not turn on `X-XSS-Protection`. The filter it controls is gone from current browsers, and in old ones it could open holes. Rely on the Content Security Policy instead.

## Read this with

- [Website playbook](https://agentwranglers.se/playbook/website.md). HTTPS, a strict Content Security Policy and the other headers that keep visitors safe live here.
- [Adversarial testing playbook](https://agentwranglers.se/playbook/adversarial-testing.md). HTTPS, script rules and security headers close many of the holes this playbook tests.
- [Agents as users playbook](https://agentwranglers.se/playbook/agents-as-users.md). Rate limits and security headers protect the same endpoints that agents call.

- Previous: [Access control](https://agentwranglers.se/playbook/application-security/access-control.md)
- Next: [Requests, files and caches](https://agentwranglers.se/playbook/application-security/requests-files-and-caches.md)
- [All chapters](https://agentwranglers.se/playbook/application-security.md)
