# CORS settings
*Security headers*
Do not combine Access-Control-Allow-Origin: * with credentials, and allow only the origins you trust.

## Why it matters
A permissive CORS policy can let another site read responses from your API on behalf of a logged-in user.
Most APIs only need a short allowlist. Being specific costs little and removes a whole class of data leaks.

## How to fix it
1. List the origins that really call the API
2. Return only those origins, and only the methods you need
3. Never pair * with Access-Control-Allow-Credentials: true

## Prompt for an AI assistant
Copy the text below and paste it into an AI assistant.
```text
You are the person improving this website. Check the item below and fix it if it applies to the site.

Item: CORS settings
Summary: Do not combine Access-Control-Allow-Origin: * with credentials, and allow only the origins you trust.
Steps:
1. List the origins that really call the API
2. Return only those origins, and only the methods you need
3. Never pair * with Access-Control-Allow-Credentials: true
References:
- CORS (MDN) (https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
- CORS (OWASP) (https://cheatsheetseries.owasp.org/cheatsheets/Cross-Origin_Resource_Sharing_Cheat_Sheet.html)

Constraints:
- Keep the existing design and tone of voice.
- Show the file or section you changed and the suggested final wording.
- Do not decide ambiguous points alone; give options and a recommendation.
- Do not change anything outside the listed item.
```

## Checked by
- **[vuln](https://ismyappok.com/en/vuln/checks)** — Public exposure checks

## Related checks
- **[Cookie attributes](https://ismyappok.com/en/checks/cookie-attributes)** — Mark session cookies Secure and HttpOnly, and set SameSite so other sites cannot send them by accident.
- **[Other security headers](https://ismyappok.com/en/checks/security-headers)** — Set X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and COOP/CORP to close the small gaps browsers leave open by default.

## References
- **[CORS (MDN)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)** — MDN (Mozilla) reference（Official）
- **[CORS (OWASP)](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Origin_Resource_Sharing_Cheat_Sheet.html)** — OWASP cheat sheet（Reference）

## Check your site now
Enter a URL and find what is missing before launch, for free.
[Run audit](https://ismyappok.com/en/audit/check)