# CORS: The 'Access-Control-Allow-Origin' header contains multiple values

**Code:** `CORS` · **Category:** HTTP · **Seen on:** HTTP, Browser, Nginx

The response carries the CORS header twice (or a comma-separated list), which browsers reject.

## Meaning

Both the app and the proxy/CDN add `Access-Control-Allow-Origin`, or a list of origins was put in one header. A response may contain exactly one value: choose the origin dynamically from an allow-list, and add CORS headers in one layer only.

## Common causes

- App and nginx/CDN both adding CORS headers
- Comma-separated origin list in the header
- Duplicate headers from middleware
- Reverse proxy `add_header` without `always` mismatch
- Two CORS libraries enabled

## Quick fix

1. Add CORS headers in one place only
2. Reflect the single matching origin
3. Remove duplicate `add_header`/middleware

## Detailed fix by platform

### cURL

1. `curl -sI -H "Origin: https://app.example.com" https://api.example.com/ | grep -i access-control`

## How to diagnose

1. **Header count** — More than one?
2. **Layers** — App and proxy?
3. **Value** — Single origin?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/http/cors-multiple-allow-origin-values)
