Skip to content

Commit dc952c0

Browse files
committed
API calls authorized with HTTP header
This mod allows API calls to be authorized with HTTP header when ENABLE_REVERSE_PROXY_AUTHENTICATION is enabled. Without it user authenticated by reverse proxy is able to access gitea UI but not API which is inconsistent. Author-Change-Id: IB#1107572
1 parent 0a23079 commit dc952c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

routers/api/v1/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ func reqToken() func(ctx *context.APIContext) {
197197
return
198198
}
199199
if ctx.IsSigned {
200+
// Don't require token if already authenticated by reverse proxy.
201+
if setting.Service.EnableReverseProxyAuth {
202+
return
203+
}
200204
ctx.RequireCSRF()
201205
return
202206
}

0 commit comments

Comments
 (0)