HTTP - Gateway (Reverse Proxy)

> (World Wide) Web - (W3|WWW) > (HTTP|HTTPS) - Hypertext Transfer Protocol

1 - About

A reverse proxy (or gateway) is a proxy that is configured to appear to the client just like an ordinary web server.

Traffic from the internet at large enters system through reverse proxy, which then routes it to the service.

The client makes ordinary http requests that are going to the proxy. The proxy then decides (based on several routing criterion) where to send internally those requests and returns the content as if it were itself the origin.

The proxy configuration that do the inverse (ie receives internal request and routes them to external service such as a website) is called a forward proxy. To be honest a gateway also forward request to internal service.

Advertising

3 - Usage

A typical usage of a reverse proxy is:

  • to enable encrypted HTTPS connections
  • to balance load among several back-end servers
  • to provide caching for a slower back-end server (performance)
  • to bring several servers into the same URL space.
  • to enable password-protection content

4 - Management

5 - Headers

An HTTP reverse proxy uses non-standard headers to inform the upstream server about the user’s IP address and other request properties:

X-Forwarded-For: ipClient, ipProxy1, ipProxy2
X-Real-IP: 12.34.56.78
X-Forwarded-Host: example.com
X-Forwarded-Proto: https

where:

  • The X-Forwarded-Proto (XFP) header is a de-facto standard header for identifying the protocol (HTTP or HTTPS) that a client used to connect to your proxy or load balancer.
  • x-forwarded-host
Advertising

6 - Example Apache

7 - Documentation / Reference