From 69e0cbef770e75ba40f7b6cbba421248705a67db Mon Sep 17 00:00:00 2001 From: Leon Klingele Date: Mon, 14 Nov 2022 03:59:32 +0100 Subject: [PATCH] ctx: make Secure() also report whether a secure connection was established to a trusted proxy We had a discussion about this in https://github.com/gofiber/helmet/pull/74. --- ctx.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ctx.go b/ctx.go index ac2e25855e..4fb7094744 100644 --- a/ctx.go +++ b/ctx.go @@ -1496,9 +1496,9 @@ func (c *Ctx) SaveFileToStorage(fileheader *multipart.FileHeader, path string, s return storage.Set(path, content, 0) } -// Secure returns a boolean property, that is true, if a TLS connection is established. +// Secure returns whether a secure connection was established. func (c *Ctx) Secure() bool { - return c.fasthttp.IsTLS() + return c.Protocol() == "https" } // Send sets the HTTP response body without copying it.