cache-proxy/config.yaml
guochao 83dfcba4ae
All checks were successful
build container / build-container (push) Successful in 5m45s
run go test / test (push) Successful in 3m15s
move x-accel into local storage configuration
2025-03-03 09:15:37 +08:00

133 lines
3.9 KiB
YAML

upstream:
- server: https://mirrors.aliyun.com
match:
match: /(debian|ubuntu|ubuntu-releases|alpine|archlinux|kali|manjaro|msys2|almalinux|rocky|centos|centos-stream|centos-vault|fedora|epel|gnu|pypi)/(.*)
replace: '/$1/$2'
- server: https://mirrors.tencent.com
match:
match: /(debian|ubuntu|ubuntu-releases|alpine|archlinux|kali|manjaro|msys2|almalinux|rocky|centos|centos-stream|centos-vault|fedora|epel|gnu)/(.*)
replace: '/$1/$2'
- server: https://mirrors.ustc.edu.cn
match:
match: /(debian|ubuntu|ubuntu-releases|alpine|archlinux|kali|manjaro|msys2|almalinux|rocky|centos|centos-stream|centos-vault|fedora|epel|elrepo|remi|rpmfusion|tailscale|gnu|rust-static|pypi)/(.*)
replace: '/$1/$2'
- server: https://packages.microsoft.com/repos/code
match:
match: /microsoft-code(.*)
replace: '$1'
- server: https://archive.ubuntu.com
match:
match: /ubuntu/(.*)
replace: /$1
# priority-groups:
# - match: /dists/.*
# priority: 10
- server: https://releases.ubuntu.com/
match:
match: /ubuntu-releases/(.*)
replace: /$1
- server: https://apt.releases.hashicorp.com
match:
match: /hashicorp-deb/(.*)
replace: /$1
- server: https://rpm.releases.hashicorp.com
match:
match: /hashicorp-rpm/(.*)
replace: /$1
- server: https://dl.google.com/linux/chrome
match:
match: /google-chrome/(.*)
replace: /$1
- server: https://pkgs.tailscale.com/stable
match:
match: /tailscale/(.*)
replace: /$1
- server: http://update.cs2c.com.cn:8080
match:
match: /kylinlinux/(.*)
replace: /$1
- server: https://cdn.jsdelivr.net
match:
match: /jsdelivr/(.*)
replace: /$1
- server: https://dl-cdn.alpinelinux.org
match:
match: /alpine/(.*)
replace: /$1
- server: https://repo.almalinux.org
match:
match: /almalinux/(.*)
replace: /almalinux/$1
- server: https://dl.rockylinux.org/pub/rocky
match:
match: /rocky/(.*)
replace: /$1
- server: https://dl.fedoraproject.org/pub/epel
match:
match: /epel/(.*)
replace: /$1
- server: https://deb.debian.org
match:
match: /(debian|debian-security)/(.*)
replace: /$1/$2
# priority-groups:
# - match: /dists/.*
# priority: 10
- server: https://static.rust-lang.org
match:
match: /rust-static/(.*)
replace: /$1
- server: https://storage.flutter-io.cn
match:
match: /flutter-storage/(.*)
replace: /$1
- server: https://cdn-mirror.chaotic.cx/chaotic-aur
match:
match: /chaotic-aur/(.*)
replace: /$1
allowed-redirect: "^https?://cf-builds.garudalinux.org/.*/chaotic-aur/.*$"
misc:
first-chunk-bytes: 31457280 ## 1024*1024*30, all upstreams with 200 response will wait for the first chunks to select a upstream by bandwidth, instead of by latency. defaults to 50M
# chunk-bytes: 1048576 ## 1024*1024
cache:
timeout: 1h
policies:
- match: '.*\.(rpm|deb|apk|iso)$' ## rpm/deb/apk/iso won't change, create only
refresh-after: never
- match: '^/.*-security/.*' ## mostly ubuntu/debian security
refresh-after: 1h
- match: '^/archlinux-localaur/.*' ## archlinux local repo
refresh-after: never
- match: '^/(archlinux.*|chaotic-aur)/*.tar.*' ## archlinux packages
refresh-after: never
- match: '/chaotic-aur/.*\.db$' ## archlinux chaotic-aur database
refresh-after: 24h
- match: '/centos/7'
refresh-after: never
- match: '/epel/7'
refresh-after: never
storage:
type: local ## ignored for now
local:
path: ./data ## defaults to ./data
accel:
## example nginx config:
## location /i {
## internal;
## alias /path/to/data;
## }
## location / {
## proxy_pass 127.0.0.1:8881;
## proxy_set_header X-Accel-Path /i;
## }
##
## then cache proxy will respond to backend a header to indicate sendfile(join(X-Accel-Path, relpath))
# enable-by-header: "X-Accel-Path"
## respond with different headers to
# respond-with-headers: [X-Sendfile, X-Accel-Redirect]