diff --git a/context.go b/context.go index 1c76c0f6..edf667b7 100644 --- a/context.go +++ b/context.go @@ -938,6 +938,15 @@ func (c *Context) RemoteIP() string { return ip } +// FromTrustProxy check if the request is from a trusted proxy server +func (c *Context) FromTrustProxy() bool { + remoteIP := net.ParseIP(c.RemoteIP()) + if remoteIP == nil { + return false + } + return c.engine.isTrustedProxy(remoteIP) +} + // ContentType returns the Content-Type header of the request. func (c *Context) ContentType() string { return filterFlags(c.requestHeader("Content-Type"))