Skip to content

Commit e39dace

Browse files
committed
修改
1 parent ed4ebd8 commit e39dace

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

‎_headers‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
X-Frame-Options: DENY
3+
X-Content-Type-Options: nosniff
4+
Referrer-Policy: strict-origin-when-cross-origin
5+
6+
/_next/static/*
7+
Cache-Control: public, max-age=31536000, immutable
8+
Content-Type: application/javascript; charset=utf-8
9+
10+
/*.css
11+
Content-Type: text/css; charset=utf-8
12+
Cache-Control: public, max-age=31536000, immutable
13+
14+
/*.woff
15+
Content-Type: font/woff
16+
Cache-Control: public, max-age=31536000, immutable
17+
18+
/*.woff2
19+
Content-Type: font/woff2
20+
Cache-Control: public, max-age=31536000, immutable
21+
22+
/*.js
23+
Content-Type: application/javascript; charset=utf-8
24+
Cache-Control: public, max-age=31536000, immutable
25+
26+
/api/*
27+
Access-Control-Allow-Origin: *
28+
Access-Control-Allow-Methods: GET,OPTIONS,PATCH,DELETE,POST,PUT
29+
Access-Control-Allow-Headers: X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version

‎edgeone.config.js‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
module.exports = {
2+
build: {
3+
command: 'npm run build',
4+
outputDirectory: '.next',
5+
},
6+
runtime: 'nodejs18.x',
7+
headers: [
8+
{
9+
source: '/_next/static/(.*)',
10+
headers: [
11+
{
12+
key: 'Cache-Control',
13+
value: 'public, max-age=31536000, immutable'
14+
},
15+
{
16+
key: 'Content-Type',
17+
value: 'application/javascript; charset=utf-8'
18+
}
19+
]
20+
},
21+
{
22+
source: '/(.*).css',
23+
headers: [
24+
{
25+
key: 'Content-Type',
26+
value: 'text/css; charset=utf-8'
27+
}
28+
]
29+
},
30+
{
31+
source: '/(.*).woff',
32+
headers: [
33+
{
34+
key: 'Content-Type',
35+
value: 'font/woff'
36+
}
37+
]
38+
},
39+
{
40+
source: '/(.*).woff2',
41+
headers: [
42+
{
43+
key: 'Content-Type',
44+
value: 'font/woff2'
45+
}
46+
]
47+
}
48+
],
49+
env: {
50+
DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY,
51+
NEXT_PUBLIC_GA_MEASUREMENT_ID: process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID,
52+
}
53+
};

‎next.config.js‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const nextConfig = {
44
DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY,
55
NEXT_PUBLIC_GA_MEASUREMENT_ID: process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID,
66
},
7+
compress: false,
8+
generateEtags: false,
9+
poweredByHeader: false,
10+
assetPrefix: '',
711
async headers() {
812
return [
913
{
@@ -14,10 +18,36 @@ const nextConfig = {
1418
{ key: 'Access-Control-Allow-Headers', value: 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version' },
1519
],
1620
},
21+
{
22+
source: '/_next/static/:path*',
23+
headers: [
24+
{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' },
25+
{ key: 'Content-Type', value: 'application/javascript; charset=utf-8' },
26+
],
27+
},
28+
{
29+
source: '/:path*.css',
30+
headers: [
31+
{ key: 'Content-Type', value: 'text/css; charset=utf-8' },
32+
],
33+
},
34+
{
35+
source: '/:path*.woff',
36+
headers: [
37+
{ key: 'Content-Type', value: 'font/woff' },
38+
],
39+
},
40+
{
41+
source: '/:path*.woff2',
42+
headers: [
43+
{ key: 'Content-Type', value: 'font/woff2' },
44+
],
45+
},
1746
];
1847
},
1948
images: {
2049
domains: ['www.codewithai.com'], // 添加你的图片域名
50+
unoptimized: true,
2151
},
2252
};
2353

0 commit comments

Comments
 (0)