mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
DOCS Add note about applying forceSSL to non-live environments
This commit is contained in:
parent
559f660e0e
commit
bf38997b6e
@ -711,6 +711,19 @@ if (!Director::isDev()) {
|
||||
}
|
||||
```
|
||||
|
||||
`forceSSL()` will only take effect in environment types that `CanonicalURLMiddleware` is configured to apply to (by
|
||||
default, only `LIVE`). To apply this behaviour in all environment types, you'll need to update that configuration:
|
||||
|
||||
```php
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Control\Middleware\CanonicalURLMiddleware;
|
||||
|
||||
if (!Director::isDev()) {
|
||||
CanonicalURLMiddleware::singleton()->setEnabledEnvs(true); // You can also specify individual environment types
|
||||
Director::forceSSL();
|
||||
}
|
||||
```
|
||||
|
||||
Forcing HTTPS so requires a certificate to be purchased or obtained through a vendor such as
|
||||
[lets encrypt](https://letsencrypt.org/) and configured on your web server.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user