Compare commits

...
Author SHA1 Message Date
Marc Seitz 36ee91498d fix: force revalidation 2024-06-15 12:27:14 +02:00
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -18,7 +18,9 @@ export default async function DomainMiddleware(req: NextRequest) {
// Subdomain available, rewriting
// >>> Rewriting: ${path} to /view/domains/${host}${path}`
url.pathname = `/view/domains/${host}${path}`;
return NextResponse.rewrite(url, PAPERMARK_HEADERS);
const response = NextResponse.rewrite(url, PAPERMARK_HEADERS);
response.headers.set("Cache-Control", "public, max-age=0, must-revalidate");
return response;
} else {
// redirect plain custom domain to papermark.io, eventually to it's own landing page
return NextResponse.redirect(new URL("https://www.papermark.io", req.url));
+2 -1
View File
@@ -230,7 +230,8 @@ export default async function handle(
...linkData,
};
res.status(200).json({ linkType, link: returnLink, brand });
res.setHeader("Cache-Control", "public, max-age=0, must-revalidate");
return res.status(200).json({ linkType, link: returnLink, brand });
} catch (error) {
log({
message: `Cannot get link for custom domain _${domainSlug}_ \n\n${error}`,