Skip to content

Commit

Permalink
fix(open-next): correctly set cache control for html pages (#353)
Browse files Browse the repository at this point in the history
* fix(open-next): correctly set cache control for html pages

* changeset

---------

Co-authored-by: conico974 <[email protected]>
  • Loading branch information
jadenv and conico974 authored Feb 1, 2024
1 parent b9eefca commit 186e28f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wet-brooms-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"open-next": patch
---

fix(open-next): correctly set cache control for html pages
2 changes: 1 addition & 1 deletion packages/open-next/src/adapters/plugins/routing/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function fixCacheHeaderForHtmlPages(
headers: Record<string, string | undefined>,
) {
// WORKAROUND: `NextServer` does not set cache headers for HTML pages — https://github.com/serverless-stack/open-next#workaround-nextserver-does-not-set-cache-headers-for-html-pages
if (HtmlPages.includes(rawPath) && headers[CommonHeaders.CACHE_CONTROL]) {
if (HtmlPages.includes(rawPath)) {
headers[CommonHeaders.CACHE_CONTROL] =
"public, max-age=0, s-maxage=31536000, must-revalidate";
}
Expand Down

0 comments on commit 186e28f

Please sign in to comment.