mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 19:27:46 +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:
parent
8f326dcac5
commit
920dbbef5e
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user