Luminova Framework

PHP Luminova: Incoming API Request Configuration

Last updated: 2026-11-28 20:57:12

Configure allowed origins, credentials, and request headers for Luminova API routes.

Configure these shared CORS settings on App\Config\Security. Use them to control which origins are allowed to access your API endpoints and which HTTP headers can be sent with requests.


Class Definition

  • Full namespace: App\Config\Security
  • File path: /app/Config/Security.php
  • This configuration derives from Luminova\Base\AbstractConfig.
  • This class is final.

Properties

The Security configuration reference also covers $httpCorsPolicyMode for selecting which requests receive CORS checks and $exposeHeaders for exposing response fields to cross-origin browser code.

forbidEmptyOrigin

Whether to reject API requests with an empty Origin header.

This property controls whether to forbid requests with an empty Origin header.When an origin is rejected and the header is missing, this flag changes the rejection to HTTP 400.

public static bool $forbidEmptyOrigin = false;

allowCredentials

Whether to include credentials in API responses.

This property controls whether to allow credentials header in API requests.The CORS response sets Access-Control-Allow-Credentials to true when this flag is enabled and the selected origin is specific.

public static bool $allowCredentials = true;

allowOrigins

Allowed origins for incoming API requests.

This property controls which origins should be allowed to access API endpoints.

  • Use '*' to allow any origin.
  • Use the string 'null' to allow the literal Origin: null value.
  • Provide an array to restrict to specific origins.
/**
 * @var string|array<int, string>
 */
public static array|string $allowOrigins = '*';

Example:

/**
 * @var string|string[]
 */
public static array|string $allowOrigins = [
    'https://example.com',
    'https://luminova.ng',
    'http://127.0.0.1'
];

allowHeaders

Allowed request headers for API requests.

This property controls which headers should be allowed in request headers when accessing API endpoints.

/**
 * @var array<int, string>
 */
public static array $allowHeaders = [];

An empty array allows all headers by default.

Example:

/**
 * @var string[]
 */
public static array $allowHeaders = [
    'Content-Type',
    'Authorization',
    'X-Requested-With',
    'Host',
    'Accept',
    'User-Agent'
];

Note:With a nonempty list, each validated request header must be allowed. Header names are matched case-insensitively.