summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/api.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-08-04 20:56:49 +0100
committerGitHub <noreply@github.com>2021-08-04 21:56:49 +0200
commit19e2c6a302cc691ab0acbc464650bb57add41d0b (patch)
tree021cb9703dddd6a42c3d782a116d64c958a3a41a /routers/api/v1/api.go
parent7c4172ef71a0805f16b8bd89188bb1b4d3e33f9b (diff)
downloadgitea-19e2c6a302cc691ab0acbc464650bb57add41d0b.tar.gz
gitea-19e2c6a302cc691ab0acbc464650bb57add41d0b.zip
Set AllowedHeaders on API CORS handler (#16524)
Set AllowedHeaders on API CORS handler and add missing Access-Control-Expose-Headers to pull API. Fix #16100 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/api/v1/api.go')
-rw-r--r--routers/api/v1/api.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index b1933366f0..b2202254da 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -569,6 +569,7 @@ func Routes() *web.Route {
//setting.CORSConfig.AllowSubdomain // FIXME: the cors middleware needs allowSubdomain option
AllowedMethods: setting.CORSConfig.Methods,
AllowCredentials: setting.CORSConfig.AllowCredentials,
+ AllowedHeaders: []string{"Authorization", "X-CSRFToken", "X-Gitea-OTP"},
MaxAge: int(setting.CORSConfig.MaxAge.Seconds()),
}))
}