An HTTP proxy is a server that receives a client's HTTP requests, forwards them to the destination server, and passes the responses back. For HTTPS sites, the client uses the CONNECT method to open a tunnel through the proxy, which then relays the encrypted traffic without being able to read it.

An HTTP proxy can read and even modify unencrypted HTTP traffic that passes through it, so sensitive data should travel over HTTPS, where the proxy only tunnels the encrypted traffic.

How an HTTP Proxy Handles a Request

  1. The client sends its request to the proxy instead of the website. For plain HTTP, it uses the full target URL; for HTTPS, it sends a CONNECT host:443 request.
  2. If the proxy requires a login, the client adds a Proxy-Authorization header.
  3. For HTTP, the proxy forwards the request to the destination. For CONNECT, it replies with a 2xx status and switches to tunnel mode.
  4. The response travels back through the proxy to the client.

Forward, Reverse and Transparent HTTP Proxies

  • Forward proxy: acts for clients and can hide their identity from websites. Users can set one up to hide their IP address while browsing.
  • Reverse proxy: acts on behalf of web servers, handling jobs such as load balancing and caching static content.
  • Transparent (intercepting) proxy: placed in the network path, so clients don't configure it and may not know it's there.

HTTP Proxy vs. SOCKS5 Proxy

HTTP proxySOCKS5 proxy
What it understandsHTTP requests and responsesNothing above the transport layer; it relays data without reading it as HTTP
Traffic it carriesWeb traffic, with HTTPS passed through a CONNECT tunnelTCP and UDP for any app that supports SOCKS
Can add headers such as ViaYesNo
In curlDefault type when the proxy has no schemeSet with a socks5:// or socks5h:// proxy URL

Caching

Some HTTP proxies store responses to reduce traffic leaving a network. MDN calls these proxy caches, a kind of shared cache. Sites mark personalized responses with Cache-Control: private so shared caches don't store them. HTTPS responses usually pass through a proxy in a tunnel, so in many cases the proxy can't cache them.

What It Means for Web Scraping

  • HTTP is often the default: curl treats a proxy given without a scheme, such as proxy.example.com:8080, as an HTTP proxy. See proxy settings for where clients store this.
  • Headers can reveal the proxy: proxies may add a Via header, and some add X-Forwarded-For with the original client IP. Check what a proxy sends before relying on it to hide your address.