HTTPS redirect middleware for the Infrastructure package (#52)
This commit is contained in:
@@ -145,6 +145,20 @@ package extension ConfigReader {
|
||||
}
|
||||
}
|
||||
|
||||
/// The HTTPS redirect middleware configuration, built from the `https.trustForwardedProto` key and ``siteOrigin``.
|
||||
///
|
||||
/// Off by default, so a deployment without a proxy in front never redirects on a header its clients could have written themselves. The redirects
|
||||
/// point at ``siteOrigin`` — the same value the pages build their canonical URLs from, so the two cannot disagree.
|
||||
var httpsRedirect: HTTPSRedirectMiddleware<AppRequestContext>.Configuration {
|
||||
.init(
|
||||
origin: siteOrigin,
|
||||
trustForwardedProto: bool(
|
||||
forKey: .HTTPS.trustForwardedProto,
|
||||
default: false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// The minimum log level the application emits at, read from the `log.level` key.
|
||||
///
|
||||
/// Falls back to `.info` when the key is unset or its value names no `Logger.Level` case.
|
||||
|
||||
Reference in New Issue
Block a user