You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3wc b29afd6fc1 Update drooooone 2 months ago
proxy Correctly set user_agent 3 months ago
transcoder Upgrade to minify v2 3 months ago
.drone.yml Update drooooone 2 months ago
.gitignore Add .gitignore 5 years ago
.travis.yml Upgrade require go version for parse 4 years ago
Dockerfile Further Dockerfile tweaks, update README 2 months ago
LICENSE initial commit 7 years ago Further Dockerfile tweaks, update README 2 months ago
compy.go use string instead of *string for Proxy.cert 4 years ago
compy_test.go Update go-httpbin import 4 years ago
go.mod Add go module configuration 3 months ago
go.sum Add go module configuration 3 months ago


Compy is an HTTP/HTTPS forward proxy with content compression/transcoding capabilities. One use case is to reduce bandwidth usage when browsing on limited mobile broadband connection.


  • HTTPS proxy (encrypted connection between client and proxy)
  • man in the middle support (compress HTTPS traffic)
  • HTTP2 support (over TLS)
  • Brotli and gzip compression
  • transcode animated GIFs to static images
  • transcode JPEG images to desired quality using libjpeg
  • transcode PNG and JPEG images to WebP
  • HTML/CSS/JavaScript minification


compy needs a few libraries to compile. On Fedora, run dnf install -y libjpeg-devel On Ubuntu, run apt-get install -y libjpeg8-dev openssl ssl-cert. On macOS, run brew install jpeg. Then compile via:

$ go get
$ cd go/src/
$ go install

go will generate the binary at go/bin/compy.


To use the proxy over HTTPS, you will need a certificate for your host. If you don't already have one, you can get one for free or you can generate a self-signed cert by running:

openssl req -x509 -newkey rsa:4096 -nodes -keyout cert.key -out cert.crt -days 3650 -subj '/CN=<your-domain>'

then visit the proxy URL and confirm that you trust your own certificate

To connect to the proxy over TLS, you will need to supply a PAC (proxy auto-config) file to the browser, as most of them do not expose this option to the UI directly. Example:

function FindProxyForURL(url, host) {
   if (url.substring(0, 5) == 'http:' || url.substring(0, 6) == 'https:') {
      return "HTTPS <your-domain>:9999";
   return "DIRECT";

This tells the browser to fetch HTTP and HTTPS URLs via the HTTPS proxy and for all other schemas, e.g., WebSocket, connect directly. Set the path to this file in the browser UI and you're good to go.


To enable man-in-the-middle support, you will need to generate a root cert to sign all the certs generated by the proxy on the fly:

openssl req -x509 -newkey rsa:4096 -nodes -keyout ca.key -out ca.crt -days 3650 -subj '/CN=<your-domain>'

and add it to your client (browser) as a trusted certificate authority


To run a simple http forward proxy:


To run it over TLS:

compy -cert cert.crt -key cert.key

With man in the middle support:

compy -ca ca.crt -cakey ca.key

Probably the best option is to run it with both TLS and MitM support, combining the two:

compy -cert cert.crt -key cert.key -ca ca.crt -cakey ca.key

You can limit access to your proxy via HTTP BASIC authentication:

compy -cert cert.crt -key cert.key -user myuser -pass mypass

You can also specify the listen port (defaults to 9999):

compy -host :9999

For compression, transcoding and minification options, see compy --help

Docker Usage

A docker image is published as thecoopcloud/compy; you can run it with

docker run -p 9999:9999 thecoopcloud/compy

To run with https enabled, you need to generate the certificates on your host and provide the path to docker:

mkdir ssl
cd ssl
openssl req -x509 -newkey rsa:4096 -nodes -keyout cert.key -out cert.crt -days 3650 -subj '/CN=<your-domain>'
openssl req -x509 -newkey rsa:4096 -nodes -keyout ca.key -out ca.crt -days 3650 -subj '/CN=<your-domain>'
cd ..
docker run -d --name compy -p 9999:9999 -v $PWD/ssl:/ssl compy -cert /ssl/cert.crt -key /ssl/cert.key -ca /ssl/ca.crt -cakey /ssl/ca.key

To rebuild the docker image locally just run:

docker build -t thecoopcloud/compy .

New image versions are automatically built and pushed to Docker Hub using Drone.