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
- Content Filtering - Block certain websites
- Access Control - Restrict which sites employees can visit
- Anonymity - Hide client IP addresses
- Caching - Cache frequently accessed content
- Security - Scan traffic for malware
- Logging - Monitor internet usage
- 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
- Open browser preferences
- Network settings
- Manual proxy configuration
- HTTP Proxy: proxy-server address
- 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.comSquid: 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 squidBasic 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 allMonitoring
# Check proxy is working
curl -x http://proxy:3128 http://example.com -v
# Monitor logs
tail -f /var/log/squid/access.logBest 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