push + pull now works with reverse proxy + basic auth on apache 2.4
This commit is contained in:
parent
937b4b5aa1
commit
37eec6c9b7
1 changed files with 81 additions and 68 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue