Skip to content

Commit 4eacd64

Browse files
committed
feat(caddyfile): 添加Caddyfile配置文件及示例脚本
新增两个Caddyfile配置文件,包括一个反向代理GitHub API的配置和一个示例运行脚本,用于通过Caddy运行指定配置文件
1 parent 3637900 commit 4eacd64

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

config/caddyfile/example.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
caddy run --config example.Caddyfile --adapter caddyfile
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 对github api 进行反向代理
2+
3+
4+
# 监听本地 33080 端口,反向代理到 GitHub API,并通过本地 7890 代理访问 GitHub
5+
:33080 {
6+
handle_path /repos/*/* {
7+
# 提取 owner 和 repo
8+
@owner_repo path_regexp ^/repos/([^/]+)/([^/]+)/?
9+
vars owner {re.owner_repo.1}
10+
vars repo {re.owner_repo.2}
11+
# 反向代理到 GitHub API,并通过本地 7890 代理
12+
rewrite * /repos/{http.vars.owner}/{http.vars.repo}
13+
reverse_proxy https://api.github.com {
14+
transport http {
15+
tls
16+
tls_insecure_skip_verify
17+
}
18+
# Add proxy configuration here instead of inside transport
19+
header_up Host api.github.com
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)