◄返回
在 Netlify 使用 Gzip 压缩数据 | @a1375625918

在 Netlify 使用 Gzip 压缩数据

2025/02/13 23:19

分类:运维


使用 _redirects_headers 文件可能不容易实现这个效果。我使用了以下 netlify.toml

1
2
3
4
/maps/:world/tiles/0/* /maps/:world/tiles/0/:splat.gz 301
/maps/:world/textures.json /maps/:world/textures.json.gz 301
/maps/:world/tiles/* /assets/empty.txt 204

1
2
3
4
5
6
7
8
/*.prbm.gz
Content-Type: application/octet-stream
Content-Encoding: gzip

/*.json.gz
Content-Type: application/json
Content-Encoding: gzip

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
[[headers]]
for = "*.json.gz"
[headers.values]
Content-Type = "application/json"
Content-Encoding = "gzip"

[[headers]]
for = "*.prbm.gz"
[headers.values]
Content-Type = "application/octet-stream"
Content-Encoding = "gzip"

[[redirects]]
from = "/maps/world/tiles/0/*"
to = "/maps/world/tiles/0/:splat.gz"
status = 301

[[redirects]]
from = "/maps/world/textures.json"
to = "/maps/world/textures.json.gz"
status = 301

[[redirects]]
from = "/maps/world/tiles/0/*"
to = "/assets/emptyTile.json"
status = 200

[[redirects]]
from = "/maps/world/tiles/*"
to = "/assets/empty.txt"
status = 204

真的要在 Netlify 上托管 BlueMap 吗?


© 2025 @a1375625918

findway.top 蜀ICP备2023008060号-1 川公网安备51019002005558号