aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-05-19 23:22:54 +0800
committerGitHub <noreply@github.com>2024-05-19 15:22:54 +0000
commita58498cc430fdc5756b8a8f893eb865c5e7080b6 (patch)
tree93e3d03a3630e1733a6d7520b80abdbaa526f6fa /routers
parent8eac16de217978c1f7034f8e360f54d8d638e95e (diff)
downloadgitea-a58498cc430fdc5756b8a8f893eb865c5e7080b6.tar.gz
gitea-a58498cc430fdc5756b8a8f893eb865c5e7080b6.zip
Improve reverse proxy documents and clarify the AppURL guessing behavior (#31003) (#31020)
Backport #31003 by wxiaoguang Fix #31002 1. Mention Make sure `Host` and `X-Fowarded-Proto` headers are correctly passed to Gitea 2. Clarify the basic requirements and move the "general configuration" to the top 3. Add a comment for the "container registry" 4. Use 1.21 behavior if the reverse proxy is not correctly configured Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Diffstat (limited to 'routers')
-rw-r--r--routers/api/packages/container/container.go2
-rw-r--r--routers/web/admin/admin_test.go2
2 files changed, 3 insertions, 1 deletions
diff --git a/routers/api/packages/container/container.go b/routers/api/packages/container/container.go
index 1efd166eb3..2a6d44ba08 100644
--- a/routers/api/packages/container/container.go
+++ b/routers/api/packages/container/container.go
@@ -116,6 +116,8 @@ func apiErrorDefined(ctx *context.Context, err *namedError) {
}
func apiUnauthorizedError(ctx *context.Context) {
+ // TODO: it doesn't seem quite right but it doesn't really cause problem at the moment.
+ // container registry requires that the "/v2" must be in the root, so the sub-path in AppURL should be removed, ideally.
ctx.Resp.Header().Add("WWW-Authenticate", `Bearer realm="`+httplib.GuessCurrentAppURL(ctx)+`v2/token",service="container_registry",scope="*"`)
apiErrorDefined(ctx, errUnauthorized)
}
diff --git a/routers/web/admin/admin_test.go b/routers/web/admin/admin_test.go
index 782126adf5..6c38f0b509 100644
--- a/routers/web/admin/admin_test.go
+++ b/routers/web/admin/admin_test.go
@@ -87,6 +87,6 @@ func TestSelfCheckPost(t *testing.T) {
err := json.Unmarshal(resp.Body.Bytes(), &data)
assert.NoError(t, err)
assert.Equal(t, []string{
- ctx.Locale.TrString("admin.self_check.location_origin_mismatch", "http://frontend/sub/", "http://host/sub/"),
+ ctx.Locale.TrString("admin.self_check.location_origin_mismatch", "http://frontend/sub/", "http://config/sub/"),
}, data.Problems)
}