Skip to content

Commit f5afe65

Browse files
[nextjs] Use config to set HTTP Server header
[According to Next.js maintainers][suggestion], this can improve performance: > If you only need custom headers, you might see better performance by > using the `headers` option in `next.config.js` instead of middleware. [suggestion]: vercel/next.js#75930 (reply in thread)
1 parent 0032e17 commit f5afe65

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

frameworks/TypeScript/nextjs/middleware.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

frameworks/TypeScript/nextjs/next.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
44
output: "standalone",
5+
6+
async headers() {
7+
return [
8+
{
9+
source: "/(.*?)",
10+
headers: [
11+
{ key: "Server", value: "Next.js" },
12+
],
13+
},
14+
]
15+
},
516
};
617

718
export default nextConfig;

0 commit comments

Comments
 (0)