-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetlify.toml
More file actions
83 lines (68 loc) · 1.88 KB
/
netlify.toml
File metadata and controls
83 lines (68 loc) · 1.88 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
[build]
publish = ".vitepress/dist"
command = "pnpm install && pnpm run build"
[build.environment]
NODE_VERSION = "22"
PNPM_VERSION = "10.13.1"
# 设置 base URL
# 部署到自定义域名根目录: VITE_BASE_URL = "/"
# 部署到 Netlify 子域根目录: VITE_BASE_URL = "/"
# 部署到 GitHub Pages 仓库: VITE_BASE_URL = "/仓库名/"
# 部署到子路径: VITE_BASE_URL = "/子路径/"
VITE_BASE_URL = "/"
# 生产环境配置 (main 分支)
[context.production.environment]
VITE_BASE_URL = "/"
# 预览环境配置 (其他分支的 deploy preview)
[context.deploy-preview.environment]
VITE_BASE_URL = "/"
# 开发分支配置 (develop 分支)
[context.branch-deploy.environment]
VITE_BASE_URL = "/"
# 示例:如果你需要为特定分支设置不同的 base URL
# [context."feature-branch".environment]
# VITE_BASE_URL = "/feature/"
# 示例:如果你需要部署到 GitHub Pages
# [context.production.environment]
# VITE_BASE_URL = "/winjs-docs/"
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "no-referrer"
X-XSS-Protection = "1; mode=block"
[[headers]]
for = "/assets/*"
[headers.values]
Cache-Control = "max-age=31536000, immutable"
[[headers]]
for = "*.svg"
[headers.values]
Cache-Control = "max-age=604800, immutable"
[[headers]]
for = "*.png"
[headers.values]
Cache-Control = "max-age=604800, immutable"
[[headers]]
for = "*.jpg"
[headers.values]
Cache-Control = "max-age=604800, immutable"
[[headers]]
for = "*.ico"
[headers.values]
Cache-Control = "max-age=604800, immutable"
# SPA fallback for client-side routing
[[redirects]]
from = "/*"
to = "/404.html"
status = 404
# Security redirects
[[redirects]]
from = "/.env"
to = "/404.html"
status = 404
[[redirects]]
from = "/.git/*"
to = "/404.html"
status = 404