From 14cfd8de230787e5547b818b845464174b9e5d6f Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Tue, 14 Jun 2022 21:05:16 -0500 Subject: [PATCH] Revert "If httpsig verification fails, fix Host header and try again" This reverts commit f53e46c721a037c55facb9200106a6b491bf834c. The bug was actually caused by nginx messing up the Host header when reverse-proxying since I didn't have the line `proxy_set_header Host $host;` in my nginx config for Gitea. --- routers/api/v1/activitypub/reqsignature.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/routers/api/v1/activitypub/reqsignature.go b/routers/api/v1/activitypub/reqsignature.go index 68f034350d..f080f4e201 100644 --- a/routers/api/v1/activitypub/reqsignature.go +++ b/routers/api/v1/activitypub/reqsignature.go @@ -90,16 +90,6 @@ func verifyHTTPSignatures(ctx *gitea_context.APIContext) (authenticated bool, er // 3. Verify the other actor's key algo := httpsig.Algorithm(setting.Federation.Algorithms[0]) authenticated = v.Verify(pubKey, algo) == nil - if authenticated { - return - } - // 4. When Gitea and the other ActivityPub server are running on the same machine, the Host header is sometimes incorrect - r.Header["Host"] = []string{setting.Domain} - v, err = httpsig.NewVerifier(r) - if err != nil { - return - } - authenticated = v.Verify(pubKey, algo) == nil return }