11 lines
335 B
Go

package utils
import "github.com/valyala/fasthttp"
// IsHTTPS tries to determine if the current request context is over HTTPS
func IsHTTPS(ctx *fasthttp.RequestCtx) bool {
return ctx.IsTLS() ||
string(ctx.Request.Header.Peek("X-Forwarded-Proto")) == "https" ||
string(ctx.Request.Header.Peek("X-Forwarded-Scheme")) == "https"
}