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
@@ -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())
