Specify AP Cache-Control (#2735)

This commit is contained in:
MeiMei 2018-09-19 07:17:19 +09:00 committed by syuilo
parent 7e9cf18032
commit 07975434d8
5 changed files with 9 additions and 0 deletions

View File

@ -75,6 +75,7 @@ router.get('/notes/:note', async (ctx, next) => {
}
ctx.body = pack(await renderNote(note, false));
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
});
@ -91,6 +92,7 @@ router.get('/notes/:note/activity', async ctx => {
}
ctx.body = pack(await packActivity(note));
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
});
@ -122,6 +124,7 @@ router.get('/users/:user/publickey', async ctx => {
if (isLocalUser(user)) {
ctx.body = pack(renderKey(user));
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
} else {
ctx.status = 400;
@ -136,6 +139,7 @@ async function userInfo(ctx: Router.IRouterContext, user: IUser) {
}
ctx.body = pack(await renderPerson(user as ILocalUser));
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
}

View File

@ -34,5 +34,6 @@ export default async (ctx: Router.IRouterContext) => {
);
ctx.body = pack(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
setResponseType(ctx);
};

View File

@ -78,6 +78,7 @@ export default async (ctx: Router.IRouterContext) => {
// index page
const rendered = renderOrderedCollection(partOf, user.followersCount, `${partOf}?page=true`, null);
ctx.body = pack(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
setResponseType(ctx);
}
};

View File

@ -78,6 +78,7 @@ export default async (ctx: Router.IRouterContext) => {
// index page
const rendered = renderOrderedCollection(partOf, user.followingCount, `${partOf}?page=true`, null);
ctx.body = pack(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
setResponseType(ctx);
}
};

View File

@ -88,6 +88,7 @@ export default async (ctx: Router.IRouterContext) => {
);
ctx.body = pack(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
setResponseType(ctx);
} else {
// index page
@ -96,6 +97,7 @@ export default async (ctx: Router.IRouterContext) => {
`${partOf}?page=true&since_id=000000000000000000000000`
);
ctx.body = pack(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
setResponseType(ctx);
}
};