diff --git a/web/shared/clientRfc9421.go b/web/shared/clientRfc9421.go index 3740678..187be1d 100644 --- a/web/shared/clientRfc9421.go +++ b/web/shared/clientRfc9421.go @@ -10,6 +10,7 @@ import ( "slices" "time" + "github.com/rs/zerolog/log" "github.com/yaronf/httpsign" "git.mstar.dev/mstar/linstrom/config" @@ -41,9 +42,10 @@ func RequestSigned( actor *models.User, ) (response *http.Response, wasRfc9421 bool, err error) { res, err := RequestSignedRFC9421(method, target, body, actor) - if err == nil { + if err == nil && res.StatusCode >= 200 && res.StatusCode < 400 { return res, true, nil } + log.Debug().Str("target", target).Msg("RFC9421 signed request failed, trying cavage signed") res, err = RequestSignedCavage(method, target, body, actor) return res, false, err } @@ -59,6 +61,8 @@ func RequestSignedRFC9421( return nil, err } applyDefaultHeaders(req) + req.Header.Add("Accept", "application/activity+json") + req.Header.Add("Content-Type", "application/activity+json") var signer *httpsign.Signer signerFields := httpsign.Headers("@request-target", "content-digest") if config.GlobalConfig.Experimental.UseEd25519Keys {