This commit is contained in:
parent
11cf35cf0d
commit
ef10fab47d
@ -26,6 +26,19 @@ func InitServer() *fiber.App {
|
|||||||
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),
|
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if viper.GetBool("hypertext.force_https") {
|
||||||
|
app.Use(func(c *fiber.Ctx) error {
|
||||||
|
if !c.Secure() {
|
||||||
|
return c.Redirect(
|
||||||
|
strings.Replace(c.Request().URI().String(), "http", "https", 1),
|
||||||
|
fiber.StatusMovedPermanently,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Next()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if viper.GetBool("telemetry.request_logging") {
|
if viper.GetBool("telemetry.request_logging") {
|
||||||
app.Use(logger.New(logger.Config{
|
app.Use(logger.New(logger.Config{
|
||||||
Output: log.Logger,
|
Output: log.Logger,
|
||||||
|
Loading…
Reference in New Issue
Block a user