srtlg / httpcache

caching HTTP proxy using Python's standard library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A zero configuration HTTP caching proxy

  • no installation required
  • just run it in this directory: python3 httpcache.py
  • useful for development of Alpine containers
  • original

Rootless Podman

Start the caching proxy

python httpcache.py

Podman uses your network

CONTAINER=$(buildah from scratch)
export http_proxy=http://localhost:8000
~/alpine-make-rootfs/alpine-make-rootfs ... rootfs.tar
buildah add $CONTAINER rootfs.tar /

Docker

Docker runs on its own network, so you have to bind to its interface

python httpcache.py -b 172.17.0.1
docker build --build-arg http_proxy=http://172.17.0.1:8000 -t container .

Docker compose has to be handled differently

mkdir /etc/systemd/system/docker.service.d
cat>/etc/systemd/system/docker.service.d/http-proxy.conf<<EOF
[Service]
Environment="HTTP_PROXY=http://172.17.0.1:8000" "http_proxy=http://172.17.0.1:8000"
EOF
systemctl daemon-reload
systemctl show docker --property Environment
systemctl restart docker

About

caching HTTP proxy using Python's standard library


Languages

Language:Python 100.0%