1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-23 00:54:28 +00:00

push + pull now works with reverse proxy + basic auth on apache 2.4

This commit is contained in:
Gogs 2016-12-28 21:33:59 +00:00 committed by Kim "BKC" Carlbäcker
parent 937b4b5aa1
commit 37eec6c9b7

View File

@ -83,6 +83,18 @@ func HTTP(ctx *context.Context) {
// check access
if askAuth {
if setting.Service.EnableReverseProxyAuth {
authUsername = ctx.Req.Header.Get(setting.ReverseProxyAuthUser)
if len(authUsername) == 0 {
ctx.HandleText(401, "reverse proxy login error. authUsername empty")
return
}
authUser, err = models.GetUserByName(authUsername)
if err != nil {
ctx.HandleText(401, "reverse proxy login error, got error while running GetUserByName")
return
}
}else{
authHead := ctx.Req.Header.Get("Authorization")
if len(authHead) == 0 {
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=\".\"")
@ -165,6 +177,7 @@ func HTTP(ctx *context.Context) {
}
}
}
}
callback := func(rpc string, input []byte) {
if rpc != "receive-pack" || isWiki {