redirect.yaml 配置模板
redirect.yaml 是放置在 Gitee 仓库内的声明式重定向清单。在「定向模板」中配置仓库与分支后,
可在「配置路径」指定该文件的位置(默认 redirect.yaml)。文件中的每个条目对应一条重定向链接,
字段与后台 Link 模型对齐,便于批量管理与版本化维护。
💡 「配置路径」说明:该路径指向仓库内的
redirect.yaml文件。当前版本以文档模板形式提供配置规范, 便于你在仓库中统一维护重定向清单。
文件位置与默认路径
- 默认路径:仓库根目录下的
redirect.yaml。 - 可在「定向模板」表单的「配置路径」字段自定义,例如
config/redirect.yaml。 - 顶层为
links列表,每一项生成一条链接。
完整示例
# redirect.yaml - Redirect 重定向配置清单
# 放置在 Gitee 仓库内(路径可配置,默认 redirect.yaml)
# 每项对应一条重定向链接,字段与后台 Link 模型对齐
links:
- code: myapp-v1.0.0 # 必填,项目内唯一短码
name: MyApp 正式版 # 可选,链接名称
targets: # 必填,目标 URL 列表
- https://mirror1.example.com/myapp.zip
- https://mirror2.example.com/myapp.zip
strategy: round_robin # 可选:random(默认) | round_robin
jump_type: file # 可选:url | page | file(默认)
jump_delay: 5 # 可选:page 类型倒计时秒数(默认 5)
link_type: file # 可选:file(默认) | page
password: "" # 可选:访问密码(明文)
rate_limit: 0 # 可选:每分钟请求限制(0 不限)
expires_at: "" # 可选:过期时间 RFC3339,如 2026-12-31T23:59:59Z
enabled: true # 可选:是否启用(默认 true)
is_public: false # 可选:是否公开(默认 false)
ip_whitelist: # 可选:IP 白名单(空=不限制)
- 192.168.1.0/24 字段说明
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
code | string | 是 | - | 项目内唯一短码(URL 路径标识) |
name | string | 否 | 空 | 链接名称 |
targets | string[] | 是 | - | 目标 URL 列表(支持多目标分发) |
strategy | string | 否 | random | 分发策略:random | round_robin |
jump_type | string | 否 | url | 跳转类型:url | page | file |
jump_delay | int | 否 | 5 | page 类型倒计时秒数 |
link_type | string | 否 | page | 链接类型:file | page |
password | string | 否 | 空 | 访问密码(明文) |
rate_limit | int | 否 | 0 | 每分钟请求限制(0 表示不限) |
expires_at | string | 否 | 空 | 过期时间(RFC3339,如 2026-12-31T23:59:59Z) |
enabled | bool | 否 | true | 是否启用 |
is_public | bool | 否 | false | 是否公开资源(可被搜索下载) |
ip_whitelist | string[] | 否 | 空 | 可访问客户端 IP 白名单(空=不限制) |
与「定向模板」配合的工作流
- 在 Gitee 仓库中按上述格式维护
redirect.yaml。 - 在「定向模板」新建模板,填写仓库地址、分支与配置路径(默认
redirect.yaml)。 - 通过「生成链接」选择对应发布版本,系统依据清单创建对应的重定向链接。