Filter
jwt_auth_cors_allow_headers
On this page
Filters the value of the Access-Control-Allow-Headers response header for REST requests.
Hooked into the REST response serving step. The string is sent as the Access-Control-Allow-Headers header when headers have not already been sent. The default list includes X-Requested-With, Content-Type, x-api-key, Accept, Origin and Authorization.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$headers | string | Comma-separated list of allowed header names. |
Return value#
string. The header value.
Example#
function my_cors_allow_headers( $headers ) {
return $headers . ', X-My-Client';
}
add_filter( 'jwt_auth_cors_allow_headers', 'my_cors_allow_headers' );
Notes#
Only the Access-Control-Allow-Headers header is sent; other CORS headers are not set by this code.
Source#
Applied in:
includes/rest-api/Server.php(line 48), inServer::add_cors_support()
Was this page helpful?
