DEV Community

vast cow
vast cow

Posted on

Using Tinyproxy as a Simple Proxy

This article focuses strictly on setting up and using Tinyproxy—a lightweight HTTP/HTTPS proxy—on Alpine Linux. The goal is to get a minimal proxy running and understand how to use it from another machine or client.


1. Installing Tinyproxy

On Alpine Linux, installation is straightforward:

apk add tinyproxy
Enter fullscreen mode Exit fullscreen mode

This installs the Tinyproxy service and default configuration files.


2. Basic Configuration

The main configuration file is typically located at:

/etc/tinyproxy/tinyproxy.conf
Enter fullscreen mode Exit fullscreen mode

At minimum, configure the following:

Port 8080
Listen 0.0.0.0
Enter fullscreen mode Exit fullscreen mode

What these settings mean

  • Port 8080
    Tinyproxy will listen for incoming proxy connections on port 8080.

  • Listen 0.0.0.0
    Allows connections from any network interface (not just localhost).
    This is required if you want to access the proxy from another machine.


3. Starting Tinyproxy

You have two operational modes depending on your use case.

Option A — Run in foreground (debug mode)

tinyproxy -d -c /etc/tinyproxy/tinyproxy.conf
Enter fullscreen mode Exit fullscreen mode
  • -d: Runs in foreground (useful for debugging/logging)
  • -c: Specifies config file

Use this when testing or troubleshooting.


Option B — Run as a background service

rc-service tinyproxy start
rc-update add tinyproxy
Enter fullscreen mode Exit fullscreen mode
  • Starts Tinyproxy as a daemon
  • Enables it to launch automatically at boot

4. Using Tinyproxy

Once running, Tinyproxy acts as a standard HTTP proxy.

Example: Using it from a client

If your Tinyproxy server is at:

172.27.59.40:8080
Enter fullscreen mode Exit fullscreen mode

You can configure tools to use it as a proxy.

Using curl

curl -x http://172.27.59.40:8080 http://example.com
Enter fullscreen mode Exit fullscreen mode

Using environment variables

export http_proxy="http://172.27.59.40:8080"
export https_proxy="http://172.27.59.40:8080"
Enter fullscreen mode Exit fullscreen mode

Now most CLI tools will route traffic through Tinyproxy.


5. Example: Using Tinyproxy with SSH (via netcat)

Tinyproxy can also proxy TCP connections using the HTTP CONNECT method.

Add this to your SSH config:

Host foomachine
    HostName 1.2.3.4
    ProxyCommand nc -X connect -x 172.27.59.40:8080 %h %p
Enter fullscreen mode Exit fullscreen mode

Explanation

  • nc -X connect → uses HTTP CONNECT proxy mode
  • -x 172.27.59.40:8080 → specifies the Tinyproxy server
  • %h %p → target host and port

Then connect normally:

ssh foomachine
Enter fullscreen mode Exit fullscreen mode

The connection will be routed through Tinyproxy.


Summary

Tinyproxy provides:

  • A minimal, lightweight HTTP/HTTPS proxy
  • Simple configuration (port + listen address)
  • Flexible usage:

    • CLI tools (curl, env vars)
    • SSH tunneling via nc
    • General proxy routing

For most use cases, the minimal configuration shown above is sufficient to get a working proxy quickly.

Top comments (0)