1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 18:20:54 +00:00

fix(context): retrieve scheme from X-Forwarded-Proto when it isn't none

This commit is contained in:
simsun 2016-07-18 22:57:13 +08:00
parent 1fe2226c11
commit ee26279311
No known key found for this signature in database
GPG Key ID: 8859A5D0ACEDCC4C

View File

@ -89,6 +89,9 @@ func (input *BeegoInput) Site() string {
// Scheme returns request scheme as "http" or "https". // Scheme returns request scheme as "http" or "https".
func (input *BeegoInput) Scheme() string { func (input *BeegoInput) Scheme() string {
if scheme := input.Header("X-Forwarded-Proto"); scheme != "" {
return scheme
}
if input.Context.Request.URL.Scheme != "" { if input.Context.Request.URL.Scheme != "" {
return input.Context.Request.URL.Scheme return input.Context.Request.URL.Scheme
} }