diff --git a/src/activitypub/index.js b/src/activitypub/index.js index 95f1e98024..a986cb2335 100644 --- a/src/activitypub/index.js +++ b/src/activitypub/index.js @@ -136,7 +136,7 @@ ActivityPub.verify = async (req) => { // Re-construct signature string const signed_string = headers.split(' ').reduce((memo, cur) => { if (cur === '(request-target)') { - memo.push(`${cur}: ${String(req.method).toLowerCase()} ${req.path}`); + memo.push(`${cur}: ${String(req.method).toLowerCase()} ${req.baseUrl}${req.path}`); } else if (req.headers.hasOwnProperty(cur)) { memo.push(`${cur}: ${req.headers[cur]}`); } diff --git a/test/activitypub.js b/test/activitypub.js index d56a57395b..d59fe1cbc1 100644 --- a/test/activitypub.js +++ b/test/activitypub.js @@ -261,9 +261,11 @@ describe('ActivityPub integration', () => { describe('.verify()', () => { let uid; let username; + const baseUrl = nconf.get('relative_path'); const mockReqBase = { method: 'GET', // path: ... + baseUrl, headers: { // host: ... // date: ...