57 lines
2.0 KiB
Markdown
57 lines
2.0 KiB
Markdown
# squid-rewriter
|
|
|
|
This is a rewrite engine for squid. It is meant to be used with the `url_rewrite_program` directive in your `squid.conf` file.
|
|
|
|
The rewrite rules are read from a yaml file. The file is expected to look like something like this:
|
|
|
|
```yaml
|
|
---
|
|
rewrites:
|
|
- name: static
|
|
urls:
|
|
- http://proxy/
|
|
destination: http://127.0.0.1:9999/
|
|
- name: fromfile
|
|
filename: myrewrites.list
|
|
destination: http://example.com/
|
|
- name: alpine
|
|
distro: alpine
|
|
destination: https://dl-cdn.alpinelinux.org/alpine/
|
|
- name: debian
|
|
distro: debian
|
|
destination: http://deb.debian.org/debian/
|
|
- name: arch
|
|
distro: arch
|
|
destination: https://geo.mirror.pkgbuild.com/
|
|
- name: fedora
|
|
distro: fedora
|
|
destination: https://fedora.mirrorservice.org/fedora/linux/
|
|
- name: fedora
|
|
distro: fedora:epel
|
|
destination: https://fedora.mirrorservice.org/epel/
|
|
- name: ubuntu
|
|
distro: ubuntu
|
|
destination: http://archive.ubuntu.com/ubuntu/
|
|
- name: mint
|
|
distro: mint
|
|
destination: https://mirrors.layeronline.com/linuxmint/
|
|
- name: slackware
|
|
distro: slackware
|
|
destination: https://www.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/
|
|
```
|
|
|
|
Each rewrite entry must contain a descriptive name (`name`) a destination url (`destination`) and one or more of the following:
|
|
|
|
- a list of static prefixes (`urls`)
|
|
- the name of a text file containing one prefix per line (`filename`)
|
|
- the name of a distribution repo (`distro`) in the format `distroname:reponame`; if reponame is omitted, it defaults to `main`; the name of the repos depend on the distro; at the moment only the `fedora` distro supports repos other than `main` (`epel`, `centos`)
|
|
|
|
On startup, squid-rewriter will look for rewrite rules in the following files:
|
|
|
|
- `rewrites.yaml` in the current directory
|
|
- `rewrites.yml` in the current directory
|
|
- `/etc/squid/rewrites.yaml`
|
|
- `/etc/squid/rewrites.yml`
|
|
|
|
Only the first existent file from the list above will be loaded.
|