CanonicalURLMiddleware
class CanonicalURLMiddleware implements HTTPMiddleware (View source)
Implements the following URL normalisation rules
- redirect basic auth requests to HTTPS
- force WWW, redirect to the subdomain "www."
- force SSL, redirect to https
Traits
A class that can be instantiated or replaced via DI
Methods
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Handles redirection to canonical urls outside of the main middleware chain using HTTPResponseException.
No description
No description
Get enabled flag, or list of environments to enable in.
Set enabled flag, or list of environments to enable in.
Details
static Injectable
create(array ...$args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
array
getForceSSLPatterns()
$this
setForceSSLPatterns(array $forceSSLPatterns)
string
getForceSSLDomain()
$this
setForceSSLDomain(string $forceSSLDomain)
bool
getForceWWW()
$this
setForceWWW(bool $forceWWW)
bool
getForceSSL()
$this
setForceSSL(bool $forceSSL)
$this
setForceBasicAuthToSSL(bool|null $forceBasicAuth)
bool
getForceBasicAuthToSSL()
HTTPResponse
process(HTTPRequest $request, callable $delegate)
Generate response for the given request
throwRedirectIfNeeded(HTTPRequest $request = null)
Handles redirection to canonical urls outside of the main middleware chain using HTTPResponseException.
Will not do anything if a current HTTPRequest isn't available
int
getRedirectType()
$this
setRedirectType(int $redirectType)
array|bool
getEnabledEnvs()
Get enabled flag, or list of environments to enable in.
$this
setEnabledEnvs(array|bool $enabledEnvs)
Set enabled flag, or list of environments to enable in.
Note: CLI is disabled by default, so "cli"(string)
or true(bool)
should be specified if you wish to
enable for testing.