mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
improve code
This commit is contained in:
@ -224,8 +224,11 @@ func (r *Request) GetRemoteIp() string {
|
||||
|
||||
// GetUrl returns current URL of this request.
|
||||
func (r *Request) GetUrl() string {
|
||||
scheme := "http"
|
||||
proto := r.Header.Get("X-Forwarded-Proto")
|
||||
var (
|
||||
scheme = "http"
|
||||
proto = r.Header.Get("X-Forwarded-Proto")
|
||||
)
|
||||
|
||||
if r.TLS != nil || (proto != "" && strings.ToLower(proto) == "https") {
|
||||
scheme = "https"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user