Fix scheme issue with X-Forwarded-Proto
This commit is contained in:
parent
e5055a1237
commit
5247afcfc6
|
@ -8,6 +8,10 @@
|
|||
file_server {
|
||||
root /home/hmn/hmn
|
||||
}
|
||||
header {
|
||||
Access-Control-Allow-Origin *
|
||||
Access-Control-Allow-Methods "GET, OPTIONS"
|
||||
}
|
||||
}
|
||||
handle {
|
||||
reverse_proxy localhost:9001
|
||||
|
|
|
@ -144,7 +144,7 @@ func (c *RequestContext) FullUrl() string {
|
|||
if scheme == "" {
|
||||
proto, hasProto := c.Req.Header["X-Forwarded-Proto"]
|
||||
if hasProto {
|
||||
scheme = fmt.Sprintf("%s://", proto)
|
||||
scheme = fmt.Sprintf("%s://", proto[0])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,6 +155,7 @@ func (c *RequestContext) FullUrl() string {
|
|||
scheme = "http://"
|
||||
}
|
||||
}
|
||||
|
||||
return scheme + c.Req.Host + c.Req.URL.String()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue