Access-Control-Allow-Headers

The HTTP Access-Control-Allow-Headers response header specifies which HTTP headers are permitted in a cross-origin request. Servers return this header as part of a CORS preflight response.

Usage

When a browser issues a preflight OPTIONS request, the Access-Control-Request-Headers header lists the non-safelisted headers the client intends to send. The server replies with Access-Control-Allow-Headers to confirm which of those headers are accepted.

CORS-safelisted headers are always permitted and do not need to appear in this list. The safelisted set includes Accept, Accept-Language, Content-Language, Content-Type (with restrictions on media type and value length), and Range (with restrictions on the format). Listing a safelisted header explicitly removes the extra restrictions on the value.

The value restrictions explain preflights that appear for no visible reason. A safelisted header stays safelisted only while its value is 128 bytes or shorter and free of bytes such as quotes, parentheses, colons, or angle brackets, and the combined length of all safelisted values has to stay within 1024 bytes. A long Accept or Accept-Language value set by a script therefore triggers a preflight, and the browser then expects the header name in Access-Control-Allow-Headers.

Multiple header names appear as a comma-separated list.

Directives

Header name list

A comma-separated set of header names the server accepts in the actual request.

Access-Control-Allow-Headers: Content-Type, Authorization

* (wildcard)

The asterisk acts as a wildcard for requests without credentials, permitting any header name.

Access-Control-Allow-Headers: *

Example

A preflight request asks whether Content-Type and a custom X-Request-ID header are allowed. The server confirms both.

Request

OPTIONS /api/data HTTP/1.1
Origin: https://app.example.re
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type,x-request-id

The browser lowercases the requested names, sorts them, and joins them with a comma and no space. The server answers with whatever casing it prefers, since matching is case-insensitive.

Response

HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://app.example.re
Access-Control-Allow-Methods: POST
Access-Control-Allow-Headers: Content-Type, X-Request-ID
Access-Control-Max-Age: 86400

A server using the wildcard for non-credentialed requests responds with a single character.

Access-Control-Allow-Headers: *

Troubleshooting

Preflight failures related to request headers produce console errors and block the actual request.

  1. Console shows "Request header field X is not allowed by Access-Control-Allow-Headers in preflight response." The server did not list the header name in the Access-Control-Allow-Headers value. Add the missing header to the preflight response. In nginx: add_header Access-Control-Allow-Headers "Content-Type, Authorization"; In Apache: Header set Access-Control-Allow-Headers "Content-Type, Authorization"

  2. Preflight response missing the header entirely. The server handles the OPTIONS request but does not include Access-Control-Allow-Headers in the response. Many frameworks require explicit CORS configuration for preflight routes. Check that the OPTIONS handler or middleware sets this header alongside Access-Control-Allow-Methods and Access-Control-Allow-Origin.

  3. Wildcard * not working with credentialed requests. When Access-Control-Allow-Credentials is true, the wildcard is treated as the literal string * and matches nothing. List each allowed header explicitly. The Authorization header is never covered by the wildcard even for non-credentialed requests and must always be named.

  4. Server middleware rejects lowercase names. The browser always sends Access-Control-Request-Headers in lowercase, and the browser matches the server's Access-Control-Allow-Headers list case-insensitively. Trouble starts in middleware that compares its configured list, written as Content-Type, against the incoming lowercase content-type with a case-sensitive string comparison and refuses to echo the name. Normalize the configured list to lowercase or use the framework's CORS module instead of a hand-written check.

  5. Sending Content-Type: application/json triggers an unexpected preflight. The Content-Type header is safelisted only for values application/x-www-form-urlencoded, multipart/form-data, and text/plain. The value application/json falls outside the safelist and forces a preflight. Add Content-Type to the Access-Control-Allow-Headers list. To confirm the preflight triggers, open DevTools Network tab and filter by method to spot the OPTIONS request preceding the actual request.

See also

Last updated: November 3, 2026