aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorNajib Idrissi <najib.idrissi.kaitouni@gmail.com>2018-08-29 16:39:16 +0200
committertechknowlogick <techknowlogick@users.noreply.github.com>2018-08-29 10:39:16 -0400
commitb9ae16d15e765aae622182789dea8c1737aad1c5 (patch)
tree854ac0f832f2a29edcbb0e0376eb07a899eefa24 /routers/repo
parentfcea86877fc56b581c8852eabf7f0c0d3c9198a9 (diff)
downloadgitea-b9ae16d15e765aae622182789dea8c1737aad1c5.tar.gz
gitea-b9ae16d15e765aae622182789dea8c1737aad1c5.zip
Make reverse proxy auth optional (#4643)
* Make reverse proxy auth optional If the option ENABLE_REVERSE_PROXY_AUTHENTICATION is enabled, make reverse proxy auth optional, instead of failing if the authentication did not succeed. Fixes #3973 Signed-off-by: Najib Idrissi <najib.idrissi.kaitouni@gmail.com> * Update http.go
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/http.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 1c3453a3a9..5b469754ad 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -83,12 +83,8 @@ 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
- }
+ authUsername = ctx.Req.Header.Get(setting.ReverseProxyAuthUser)
+ if setting.Service.EnableReverseProxyAuth && len(authUsername) > 0 {
authUser, err = models.GetUserByName(authUsername)
if err != nil {
ctx.HandleText(401, "reverse proxy login error, got error while running GetUserByName")