-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
45 lines (42 loc) · 1.34 KB
/
Copy pathnext.config.ts
File metadata and controls
45 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type { NextConfig } from "next";
/**
* Applied to every response. A `Content-Security-Policy` is deliberately absent:
* a meaningful one needs per-request nonces for Next's bootstrap scripts, which
* forces every route dynamic and would undo the static generation of the whole
* site. Add it through `proxy.ts` only if the tradeoff is worth it.
*/
const securityHeaders = [
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=(), interest-cohort=()",
},
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
];
const nextConfig: NextConfig = {
allowedDevOrigins: ["127.0.0.1"],
// Leaks the framework version for no benefit.
poweredByHeader: false,
async headers() {
return [
{
source: "/:path*",
headers: securityHeaders,
},
{
// The admin surface is session-gated; keep it out of caches entirely.
source: "/admin/:path*",
headers: [
{ key: "Cache-Control", value: "no-store, max-age=0" },
{ key: "X-Robots-Tag", value: "noindex, nofollow" },
],
},
];
},
};
export default nextConfig;