DevOps Journey
Core Concepts

Forward Proxies

Forward proxy concepts and use cases

Forward Proxies

A forward proxy sits between clients and the internet, forwarding client requests to external servers.

What is a Forward Proxy?

A forward proxy:

  • Sits between clients and internet servers
  • Clients connect to proxy instead of directly to servers
  • Proxy forwards requests to destination servers
  • Returns responses from servers to clients
  • Clients know they're using a proxy

Use Cases

  1. Content Filtering - Block certain websites
  2. Access Control - Restrict which sites employees can visit
  3. Anonymity - Hide client IP addresses
  4. Caching - Cache frequently accessed content
  5. Security - Scan traffic for malware
  6. Logging - Monitor internet usage
  7. Bandwidth Control - Limit bandwidth usage

How It Works

Request Flow

1. Client sends request to proxy
   GET http://example.com/page HTTP/1.1

2. Proxy receives request and applies rules

3. Proxy forwards request to external server
   GET http://example.com/page HTTP/1.1

4. External server responds
   200 OK
   [content]

5. Proxy returns response to client
   200 OK
   [content]

Client Configuration

Browser Settings

  1. Open browser preferences
  2. Network settings
  3. Manual proxy configuration
  4. HTTP Proxy: proxy-server address
  5. Port: proxy port

Linux Command Line

# Temporary
export http_proxy=http://proxy:3128
export https_proxy=http://proxy:3128

# Using curl
curl -x http://proxy:3128 http://example.com

# Using wget
wget -e use_proxy=yes -e http_proxy=http://proxy:3128 http://example.com

Squid: Open Source Proxy

Installation

# Install Squid
sudo apt install squid

# Start service
sudo systemctl start squid
sudo systemctl enable squid

# Check status
sudo systemctl status squid

Basic Configuration

# Main config file
/etc/squid/squid.conf

# Listen on port 3128 (default)
http_port 3128

# Allow local network
acl localnet src 192.168.0.0/16
http_access allow localnet

# Deny all others
http_access deny all

Monitoring

# Check proxy is working
curl -x http://proxy:3128 http://example.com -v

# Monitor logs
tail -f /var/log/squid/access.log

Best Practices

  • Define clear access policies
  • Use ACLs to restrict access
  • Enable caching for efficiency
  • Monitor and log all traffic
  • Implement authentication
  • Use HTTPS where possible
  • Document proxy rules
  • Test policies before deployment
  • Keep proxy software updated

On this page