mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-01-14 10:42:56 -05:00
update cache-control headers
This commit is contained in:
@@ -7,9 +7,9 @@ module.exports = {
|
||||
timeZone: "America/New_York", // https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
|
||||
baseUrl:
|
||||
// NOTE: no trailing slashes!
|
||||
process.env.NEXT_PUBLIC_VERCEL_URL && process.env.NEXT_PUBLIC_VERCEL_ENV !== "production"
|
||||
process.env.NEXT_PUBLIC_VERCEL_ENV !== "production" && process.env.NEXT_PUBLIC_VERCEL_URL !== undefined
|
||||
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
|
||||
: process.env.IS_DEV_SERVER
|
||||
: process.env.IS_DEV_SERVER === true
|
||||
? `http://localhost:${process.env.NEXT_DEV_PORT}`
|
||||
: "https://jarv.is", // fallback to production URL
|
||||
onionDomain: "http://jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion",
|
||||
|
||||
@@ -47,7 +47,7 @@ export const buildFeed = async (
|
||||
link: note.permalink,
|
||||
title: note.title,
|
||||
description: note.description,
|
||||
image: note.image ? `${config.baseUrl}${note.image}` : "",
|
||||
image: note.image && `${config.baseUrl}${note.image}`,
|
||||
author: [
|
||||
{
|
||||
name: config.authorName,
|
||||
@@ -59,7 +59,10 @@ export const buildFeed = async (
|
||||
});
|
||||
|
||||
// cache on edge for 12 hours by default
|
||||
res.setHeader("cache-control", `s-maxage=${options.edgeCacheAge ?? 43200}, stale-while-revalidate=3600`);
|
||||
res.setHeader(
|
||||
"cache-control",
|
||||
`public, max-age=0, s-maxage=${options.edgeCacheAge ?? 86400}, stale-while-revalidate`
|
||||
);
|
||||
|
||||
// generates RSS by default
|
||||
if (options.type === "rss") {
|
||||
@@ -74,7 +77,7 @@ export const buildFeed = async (
|
||||
res.setHeader("content-type", "application/feed+json; charset=utf-8");
|
||||
res.write(feed.json1());
|
||||
} else {
|
||||
throw new TypeError("Invalid feed type, must be 'rss', 'atom', or 'json'.");
|
||||
throw new TypeError(`Invalid feed type "${options.type}", must be "rss", "atom", or "json".`);
|
||||
}
|
||||
|
||||
res.end();
|
||||
|
||||
Reference in New Issue
Block a user