Skip to content

Instantly share code, notes, and snippets.

@smothiki
Created December 9, 2025 01:20
Show Gist options
  • Select an option

  • Save smothiki/0a0176bffaa63954ded4be9aeb135611 to your computer and use it in GitHub Desktop.

Select an option

Save smothiki/0a0176bffaa63954ded4be9aeb135611 to your computer and use it in GitHub Desktop.
  1. Pull and Run the Squid Container Run the following command in your terminal. This uses the popular ubuntu/squid image.
docker run -d --name squid-local -e 'TZ=UTC' -p 3128:3128 ubuntu/squid:latest
-d: Runs in detached mode (background).

-p 3128:3128: Maps port 3128 on your machine to port 3128 in the container (Squid's default port).
  1. Verify it is Running Check the logs to ensure it started correctly: Bash

docker logs squid-local

Method 2: Direct Installation (Linux/Ubuntu)

  1. Configure Access (Crucial Step) By default, Squid denies most traffic. For local testing, you usually need to allow your local IP range.

    Open the config file: sudo nano /etc/squid/squid.conf add the following line to the squid proxy conf acl allowed_http_sites dstdom_regex -i (^|\.)huggingface\.co

    Find the line http_access allow localhost (it usually exists by default).

    If you want to allow any device on your local network (be careful with this in production), add this line above any deny all rules: Plaintext

    http_access allow all

    Save and exit (Ctrl+O, Enter, Ctrl+X).

  2. Restart Squid Apply the changes: Bash

sudo systemctl restart squid

Method 3: Direct Installation (macOS)

If you are on a Mac, use Homebrew:

Install: brew install squid

Start Service: brew services start squid

Config Location: /usr/local/etc/squid.conf (Intel) or /opt/homebrew/etc/squid.conf (Apple Silicon).

How to Test Your Proxy

Once Squid is running (via Docker or Local Install), test it using curl.

  1. Check your IP without the proxy: Bash

curl http://httpbin.org/ip

Result: You should see your actual public IP.
  1. Check your IP through the proxy: Bash

curl -x http://localhost:3128 http://httpbin.org/ip

Result: If successful, you will still see your IP (Squid is transparent by default), but the request went through the proxy.
  1. Check the Access Logs To confirm the traffic actually hit Squid, check the access logs.

    Docker: docker exec -it squid-local tail -f /var/log/squid/access.log

    Linux: sudo tail -f /var/log/squid/access.log

You should see an entry for TCP_MISS/200 or TCP_TUNNEL/200 corresponding to your

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment