CodeIgniter v4.5 API

Cors
in package

Cross-Origin Resource Sharing (CORS)

Tags
see
CorsTest

Table of Contents

Properties

$config  : array{allowedOrigins: list, allowedOriginsPatterns: list, supportsCredentials: bool, allowedHeaders: list, exposedHeaders: list, allowedMethods: list, maxAge: int}

Methods

__construct()  : mixed
addResponseHeaders()  : ResponseInterface
Adds CORS headers to the Response.
factory()  : self
Creates a new instance by config name.
handlePreflightRequest()  : ResponseInterface
Handles the preflight request, and returns the response.
isPreflightRequest()  : bool
Whether if the request is a preflight request.
checkWildcard()  : void
checkWildcardAndCredentials()  : void
setAllowCredentials()  : void
setAllowHeaders()  : void
setAllowMaxAge()  : void
setAllowMethods()  : void
setAllowOrigin()  : void
setExposeHeaders()  : void

Properties

$config

private array{allowedOrigins: list, allowedOriginsPatterns: list, supportsCredentials: bool, allowedHeaders: list, exposedHeaders: list, allowedMethods: list, maxAge: int} $config = ['allowedOrigins' => [], 'allowedOriginsPatterns' => [], 'supportsCredentials' => false, 'allowedHeaders' => [], 'exposedHeaders' => [], 'allowedMethods' => [], 'maxAge' => 7200]

Methods

__construct()

public __construct([array{allowedOrigins?: list, allowedOriginsPatterns?: list, supportsCredentials?: bool, allowedHeaders?: list, exposedHeaders?: list, allowedMethods?: list, maxAge?: int}|Cors|null $config = null ]) : mixed
Parameters
$config : array{allowedOrigins?: list, allowedOriginsPatterns?: list, supportsCredentials?: bool, allowedHeaders?: list, exposedHeaders?: list, allowedMethods?: list, maxAge?: int}|Cors|null = null

factory()

Creates a new instance by config name.

public static factory([string $configName = 'default' ]) : self
Parameters
$configName : string = 'default'
Return values
self

isPreflightRequest()

Whether if the request is a preflight request.

public isPreflightRequest(IncomingRequest $request) : bool
Parameters
$request : IncomingRequest
Return values
bool

checkWildcard()

private checkWildcard(string $name, int $count) : void
Parameters
$name : string
$count : int

checkWildcardAndCredentials()

private checkWildcardAndCredentials(string $name, string $header) : void
Parameters
$name : string
$header : string

        
On this page

Search results