Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Set 404 Revalidate timer to 900 seconds. #1639

Merged
merged 8 commits into from
Nov 17, 2023
Merged

RFC: Set 404 Revalidate timer to 900 seconds. #1639

merged 8 commits into from
Nov 17, 2023

Conversation

theodesp
Copy link
Member

@theodesp theodesp commented Nov 9, 2023

Tasks

  • I have signed a Contributor License Agreement (CLA) with WP Engine.
  • If a code change, I have written testing instructions that the whole team & outside contributors can understand.
  • I have written and included a comprehensive changeset to properly document the changes I've made.

Description

Sets the default ISR revalidate timer on 404 pages.

Closes #1580

Related Issue(s):

Testing

  1. Checkout and Build the project.
  2. Run the project in production mode (npm run start) vs in dev mode (npm run dev)
  3. Run a curl command that will tigger a 404 response.
  4. You should see the following header in cache-control:
    Cache-Control: s-maxage=900, stale-while-revalidate

Screenshots

Before

❯ curl -vvv http://localhost:3000/222 | grep cache-control
...
>
< HTTP/1.1 404 Not Found
< x-using: faust
< x-nextjs-cache: HIT
< Cache-Control: s-maxage=31536000, stale-while-revalidate
< ETag: "inm7ps8d27200"
< Content-Type: text/html; charset=utf-8
< Content-Length: 2592
< Vary: Accept-Encoding
< Date: Thu, 09 Nov 2023 12:28:23 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5

After

❯ curl -vvv http://localhost:3000/222 | grep cache-control
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1:3000...
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /222 HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/1.1 404 Not Found
< x-using: faust
< x-nextjs-cache: HIT
< Cache-Control: s-maxage=900, stale-while-revalidate
< ETag: "7hstphb9w0200"
< Content-Type: text/html; charset=utf-8
< Content-Length: 2592
< Vary: Accept-Encoding
< Date: Thu, 09 Nov 2023 12:33:07 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
{ [2592 bytes data]

Documentation Changes

Dependant PRs

@theodesp theodesp requested a review from a team as a code owner November 9, 2023 12:43
Copy link

changeset-bot bot commented Nov 9, 2023

⚠️ No Changeset found

Latest commit: 3111854

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Nov 9, 2023

📦 Next.js Bundle Analysis for @faustwp/getting-started-example

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@blakewilson
Copy link
Contributor

@theodesp You may want to update your testing instructions to mention that the user needs to also:

  1. Build the example project
  2. Run the project in production mode (npm run start) vs in dev mode (npm run dev)

@theodesp theodesp requested a review from blakewilson November 13, 2023 17:38
Copy link
Contributor

@blakewilson blakewilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add back the carrots to the example project's package.json but other than that, this looks good to go! Nice work @theodesp

examples/next/faustwp-getting-started/package.json Outdated Show resolved Hide resolved
@theodesp theodesp requested a review from blakewilson November 16, 2023 14:24
@josephfusco josephfusco added the package: @faustwp/core Related to the Faust Core package label Nov 16, 2023
@theodesp theodesp merged commit 50a8d08 into canary Nov 17, 2023
18 checks passed
@theodesp theodesp deleted the MERL-1226 branch November 17, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: @faustwp/core Related to the Faust Core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Next.js 404 Cache Fix for Faust
3 participants