Skip to content

Commit

Permalink
feat: add cache-control: no-cache header for 404 responses
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax committed Oct 13, 2024
1 parent a399e18 commit db7e5ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/internal/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export default defineNitroErrorHandler(
);
}

if (statusCode === 404) {
setResponseHeader(event, 'Cache-Control', 'no-cache');
}

setResponseStatus(event, statusCode, statusMessage);

if (isJsonRequest(event)) {
Expand Down

0 comments on commit db7e5ab

Please sign in to comment.