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