Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // RequestHeaderProtocol header for identifying the protocol (HTTP or HTTPS) that a client used to connect to your proxy or load balancer. RequestHeaderProtocol = "X-Forwarded-Proto" // RequestHeaderForwarded header for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or a load balancer. RequestHeaderForwarded = "X-Forwarded-For" )
Functions ¶
func RequestRawURL ¶
RequestRawURL returns request original URL.
func RequestRemoteAddr ¶
RequestRemoteAddr finds the real remote address from request.
If the web server is behind an HTTP proxy or a load balancer, http.Request.RemoteAddr is IP of the proxy or load balancer. But most HTTP proxies and load balancers will attach a header to tell the web server request's real IP.
func RequestScheme ¶
RequestScheme try to parses request scheme.
If the web server is behind an HTTP proxy or a load balancer, it's hard to known if original request's scheme by http.Request.TLS property. Most HTTP proxies and load balancers will attach a header to tell upstream server the request's real scheme. So check if the header is set first.
Types ¶
This section is empty.