diff options
| author | momoirodouhu <momoirodouhu@gmail.com> | 2023-02-12 08:22:42 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-12 08:22:42 +0900 |
| commit | f28aea9e303af96978da5e27739b5fd8e23b8f86 (patch) | |
| tree | 10143cc680c6b22a1502142c727eeef15ee69616 /packages/backend/src/server/ActivityPubServerService.ts | |
| parent | fix: pagenation (#9885) (diff) | |
| download | sharkey-f28aea9e303af96978da5e27739b5fd8e23b8f86.tar.gz sharkey-f28aea9e303af96978da5e27739b5fd8e23b8f86.tar.bz2 sharkey-f28aea9e303af96978da5e27739b5fd8e23b8f86.zip | |
add cors header to ActivityPubServerService.ts (#9888)
* add cors header to ActivityPubServerService.ts
* Update CHANGELOG.md
Diffstat (limited to 'packages/backend/src/server/ActivityPubServerService.ts')
| -rw-r--r-- | packages/backend/src/server/ActivityPubServerService.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index 186d3822d8..5480395eeb 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -441,6 +441,14 @@ export class ActivityPubServerService { fastify.addContentTypeParser('application/activity+json', { parseAs: 'string' }, fastify.getDefaultJsonParser('ignore', 'ignore')); fastify.addContentTypeParser('application/ld+json', { parseAs: 'string' }, fastify.getDefaultJsonParser('ignore', 'ignore')); + fastify.addHook('onRequest', (request, reply, done) => { + reply.header('Access-Control-Allow-Headers', 'Accept'); + reply.header('Access-Control-Allow-Methods', 'GET, OPTIONS'); + reply.header('Access-Control-Allow-Origin', '*'); + reply.header('Access-Control-Expose-Headers', 'Vary'); + done(); + }); + //#region Routing // inbox (limit: 64kb) fastify.post('/inbox', { bodyLimit: 1024 * 64 }, async (request, reply) => await this.inbox(request, reply)); |