mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
fix: server access logs contain the protocol used between the server and the load balancer, but not the protocol used between the client and the load balancer
This commit is contained in:
@ -225,7 +225,8 @@ func (r *Request) GetRemoteIp() string {
|
||||
// GetUrl returns current URL of this request.
|
||||
func (r *Request) GetUrl() string {
|
||||
scheme := "http"
|
||||
if r.TLS != nil {
|
||||
proto := r.Header.Get("X-Forwarded-Proto")
|
||||
if r.TLS != nil || (proto != "" && strings.ToLower(proto) == "https") {
|
||||
scheme = "https"
|
||||
}
|
||||
return fmt.Sprintf(`%s://%s%s`, scheme, r.Host, r.URL.String())
|
||||
|
||||
Reference in New Issue
Block a user