diff options
| author | Mary <Ipadlover8322@gmail.com> | 2023-01-16 12:21:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-17 02:21:15 +0900 |
| commit | 3feaf39294052c1edd0753fb9c3968ba2c05f57f (patch) | |
| tree | 033f482a016f480cba3844d4e45c445cb32afb1d | |
| parent | add comments to CHANGELOG (diff) | |
| download | misskey-3feaf39294052c1edd0753fb9c3968ba2c05f57f.tar.gz misskey-3feaf39294052c1edd0753fb9c3968ba2c05f57f.tar.bz2 misskey-3feaf39294052c1edd0753fb9c3968ba2c05f57f.zip | |
ApRequestService: don't generate our own Host header (#9378)
| -rw-r--r-- | packages/backend/src/core/activitypub/ApRequestService.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/backend/src/core/activitypub/ApRequestService.ts b/packages/backend/src/core/activitypub/ApRequestService.ts index d44d06a442..ab22a0c411 100644 --- a/packages/backend/src/core/activitypub/ApRequestService.ts +++ b/packages/backend/src/core/activitypub/ApRequestService.ts @@ -57,7 +57,7 @@ export class ApRequestService { method: 'POST', headers: this.objectAssignWithLcKey({ 'Date': new Date().toUTCString(), - 'Host': u.hostname, + 'Host': u.host, 'Content-Type': 'application/activity+json', 'Digest': digestHeader, }, args.additionalHeaders), @@ -83,7 +83,7 @@ export class ApRequestService { headers: this.objectAssignWithLcKey({ 'Accept': 'application/activity+json, application/ld+json', 'Date': new Date().toUTCString(), - 'Host': new URL(args.url).hostname, + 'Host': new URL(args.url).host, }, args.additionalHeaders), }; @@ -106,6 +106,8 @@ export class ApRequestService { request.headers = this.objectAssignWithLcKey(request.headers, { Signature: signatureHeader, }); + // node-fetch will generate this for us. if we keep 'Host', it won't change with redirects! + delete request.headers['host']; return { request, |