Skip to content

Commit

Permalink
Disabled caching for ActivityPub & WebFinger
Browse files Browse the repository at this point in the history
ref https://linear.app/tryghost/issue/MOM-25

Whilst we're experimenting it's gonna be easier to not have to think about
caching affecting things. We'll disable it completely for now, and then decide
on a caching strategy that suits us down the line.
  • Loading branch information
allouis committed Apr 18, 2024
1 parent e8ea2e4 commit 9e98be9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Controller, Get, Param} from '@nestjs/common';
import {Controller, Get, Header, Param} from '@nestjs/common';
import {Roles} from '../../../common/decorators/permissions.decorator';
import ObjectID from 'bson-objectid';
import {JSONLDService} from '../../../core/activitypub/jsonld.service';
Expand All @@ -9,6 +9,7 @@ export class ActivityPubController {
private readonly service: JSONLDService
) {}

@Header('Cache-Control', 'no-store')
@Roles(['Anon'])
@Get('actor/:id')
async getActor(@Param('id') id: unknown) {
Expand All @@ -18,6 +19,7 @@ export class ActivityPubController {
return this.service.getActor(ObjectID.createFromHexString(id));
}

@Header('Cache-Control', 'no-store')
@Roles(['Anon'])
@Get('key/:owner')
async getKey(@Param('owner') owner: unknown) {
Expand All @@ -27,6 +29,7 @@ export class ActivityPubController {
return this.service.getPublicKey(ObjectID.createFromHexString(owner));
}

@Header('Cache-Control', 'no-store')
@Roles(['Anon'])
@Get('outbox/:owner')
async getOutbox(@Param('owner') owner: unknown) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Controller, Get, Query} from '@nestjs/common';
import {Controller, Get, Header, Query} from '@nestjs/common';
import {WebFingerService} from '../../../core/activitypub/webfinger.service';

@Controller('.well-known/webfinger')
Expand All @@ -7,6 +7,7 @@ export class WebFingerController {
private readonly service: WebFingerService
) {}

@Header('Cache-Control', 'no-store')
@Get('')
async getResource(@Query('resource') resource: unknown) {
if (typeof resource !== 'string') {
Expand Down

0 comments on commit 9e98be9

Please sign in to comment.