class InitialisationMiddleware implements HTTPMiddleware (View source)

Initialises CWP-specific configuration settings, to avoid _config.php.

Traits

Provides extensions to this object to integrate it with standard config API methods.

Properties

static private bool $xss_protection_enabled

Disable the automatically added 'X-XSS-Protection' header that is added to all responses. This should be left alone in most circumstances to include the header. Refer to Mozilla Developer Network for more information: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection

static private bool $egress_proxy_default_enabled

Enable egress proxy. This works on the principle of setting http(s)_proxy environment variables, which will be automatically picked up by curl. This means RestfulService and raw curl requests should work out of the box. Stream-based requests need extra manual configuration.

static private string[] $egress_proxy_exclude_domains

Configure the list of domains to bypass proxy by setting the NO_PROXY environment variable.

static private string $strict_transport_security

Provide a value for the HTTP Strict Transport Security header.

Methods

static Config_ForClass
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

mixed
stat(string $name) deprecated

Get inherited config value

mixed
uninherited(string $name)

Gets the uninherited value for the given config option

$this
set_stat(string $name, mixed $value) deprecated

Update the config value for a given property

process(HTTPRequest $request, callable $delegate)

Generate response for the given request

Details

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

HTTPResponse process(HTTPRequest $request, callable $delegate)

Generate response for the given request

Parameters

HTTPRequest $request
callable $delegate

Return Value

HTTPResponse