vimacs's personal siteWritten with Vim and Emacs

用 Caddy 建立反向代理

最近尝试使用 Hyperbola 这个发行版,可是它的镜像源都太慢了,于是我考虑在我的服务器上建个镜像源的反向代理。

我的服务器使用 Caddy,它支持 proxy,在 proxy 的选项中有一个 without 字段,可以在访问上游服务器前去掉请求 URI 的前缀,于是可以很方便地建立多个代理。

当前我建立了 Hyperbola 和 Devuan 镜像源的反向代理,Caddy 的配置如下:

http://mirror.wehack.space https://mirror.wehack.space {
      # tls settings ...

      proxy /hyperbola/ https://repo.hyperbola.info:50012 {
              without /hyperbola
              transparent
      }

      proxy /devuan/ http://deb.devuan.org {
              without /devuan
              transparent
      }
}