a forward proxy for upstream origin access with internal https redirection capabilities
280
forward-proxy is a lightweight, high-performance HTTP proxy designed specifically for Varnish-based CDN architectures, particularly for serving Deb/RPM repositories (APT, DNF, YUM, EPEL, Fedora Metalink, Rocky Linux mirrorlist, etc).
It is implemented in Go, optimized for extremely high concurrency, and runs in a minimal scratch container with no shell, no glibc, and no OS dependencies.
Transparent HTTP/HTTPS upstream proxy
Host header to route requestsRange, If-Modified-Since, If-None-Match, etc.X-Forwarded-Proto)Custom DNS resolver
UPSTREAM_DNS)Mirrorlist & Metalink Engine
Rule-based dynamic mirroring using a single YAML config
Supports:
/mirrorlist/metalinkProgrammable with templates and matching rules
Prometheus Instrumentation
Streaming Mode (Zero Buffering)
Health & Readiness Endpoints
/healthz and /readyzWorks perfectly with Varnish
Range headersAll configuration can be done using environment variables:
| Variable | Description | Default |
|---|---|---|
LISTEN_ADDR | Address for proxy server | :8080 |
METRICS_LISTEN_ADDR | Address for Prometheus metrics | :9090 |
UPSTREAM_DNS | Comma-separated DNS resolvers | Cloudflare + Google |
MIRROR_CONFIG | Path to YAML mirror configuration file | (disabled if not set) |
A full dynamic mirror configuration engine is included.
Example:
tmirrors:
- name: rocky-mirrorlist
host: mirrors.rockylinux.org
path_prefix: /mirrorlist
base_url: http://myrocky-mirror.local
repo_split_pattern: "^(?P<base>.*?)-(?P<version>[0-9]+)$"
rules:
- name: altarch
when: { repo_contains: altarch }
template: "{base_url}/pub/sig/{version}/altarch/{arch}/altarch-common"
default_template: "{base_url}/pub/rocky/{version}/{base}/{arch}/os/"
This proxy is designed for very high throughput:
Tested successfully with:
aptdnfyumlibdnfcurlbereq pass-throughBuilt using:
FROM scratch
COPY forward-proxy /forward-proxy
COPY /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/forward-proxy"]
Total image size is typically under 15 MB, including CA certs.
Content type
Image
Digest
sha256:9cdd5696e…
Size
6.5 MB
Last updated
10 months ago
docker pull jlcox1970/forward-proxy:1.0.0