mirror of
https://github.com/thomiceli/opengist.git
synced 2025-06-14 14:17:14 +02:00
Fix oauth endpoint to support detecting https in 'Forwarded' header, enabling google support (#359)
This commit is contained in:
@ -315,6 +315,20 @@ func oauth(ctx echo.Context) error {
|
|||||||
httpProtocol = "https"
|
httpProtocol = "https"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forwarded_hdr := ctx.Request().Header.Get("Forwarded")
|
||||||
|
if forwarded_hdr != "" {
|
||||||
|
fields := strings.Split(forwarded_hdr, ";")
|
||||||
|
fwd := make(map[string]string)
|
||||||
|
for _, v := range fields {
|
||||||
|
p := strings.Split(v, "=")
|
||||||
|
fwd[p[0]] = p[1]
|
||||||
|
}
|
||||||
|
val, ok := fwd["proto"]
|
||||||
|
if ok && val == "https" {
|
||||||
|
httpProtocol = "https"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var opengistUrl string
|
var opengistUrl string
|
||||||
if config.C.ExternalUrl != "" {
|
if config.C.ExternalUrl != "" {
|
||||||
opengistUrl = config.C.ExternalUrl
|
opengistUrl = config.C.ExternalUrl
|
||||||
|
Reference in New Issue
Block a user