---
title: "Share data across sites on purpose · Agent Wranglers"
url: https://agentwranglers.se/playbook/application-security/browser-security-headers/strict-cors
id: APS-37
level: Recommended
updated: 2026-10-27
build: a2a6bdfed830
tokens: 678
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Share data across sites on purpose

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

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

- ID: APS-37
- Level: Recommended
- Chapter: [Browser security headers](https://agentwranglers.se/playbook/application-security/browser-security-headers.md)
- Rule: 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.
- Check: The agent sends requests to an API that uses cookies, with `Origin: https://evil.example.net`, `Origin: null` and `Origin: https://example.com.evil.example.net`. No reply allows any of them.
- How: Compare the `Origin` with a list and answer only for exact matches. Send `Access-Control-Allow-Credentials: true` only for those. Add `Vary: Origin`, so a cache never serves one origin's answer to another. A public API without cookies can allow `*`.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Shell example

```sh
curl -sI -H 'Origin: https://evil.example.net' https://api.staging.example.com/me | grep -i access-control
```

## Sources

- [Fetch Standard on the CORS protocol](https://fetch.spec.whatwg.org/#http-cors-protocol)

## Related rules

- WEB-168 [Serve standard files at fixed addresses](https://agentwranglers.se/playbook/website/standard-addresses/well-known-overview.md) in Website
- API-38 [Authenticate with tokens in headers](https://agentwranglers.se/playbook/api-design/api-security/token-auth.md) in API design

**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/strict-cors">Agent Wranglers application security playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Sending the old XSS filter header](https://agentwranglers.se/playbook/application-security/browser-security-headers/x-xss-protection.md)
- Next: [Check the origin of WebSocket connections](https://agentwranglers.se/playbook/application-security/browser-security-headers/websocket-origin.md)
- [Browser security headers](https://agentwranglers.se/playbook/application-security/browser-security-headers.md)
