HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleio-streams-haproxy-1.0.1.0Haskell2010

System.IO.Streams.Network.HAProxy

HAProxy proxying protocol support (see http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt) for applications using io-streams. The proxy protocol allows information about a networked peer (like remote address and port) to be propagated through a forwarding proxy that is configured to speak this protocol.

This approach is safer than other alternatives like injecting a special HTTP header (like "X-Forwarded-For") because the data is sent out of band, requests without the proxy header fail, and proxy data cannot be spoofed by the client.

  • 1 type
  • 9 values

Proxying requests.

3 declarations
valuebehindHAProxy
  1. :: Socket

    A socket you've just accepted

  2. -> SockAddr

    and its peer address

  3. -> (ProxyInfo -> InputStream ByteString -> OutputStream ByteString -> IO a)
  4. -> IO a
#

Parses the proxy headers emitted by HAProxy and runs a user action with the origin/destination socket addresses provided by HAProxy. Will throw a Sockets.ParseException if the protocol header cannot be parsed properly.

We support version 1.5 of the protocol (both the "old" text protocol and the "new" binary protocol.). Typed data fields after the addresses are not (yet) supported.

Information about proxied requests.

7 declarations
datadata ProxyInfo
#

Stores information about the proxied request.

Instances1Show
  • Show ProxyInfoDefined in io-streams-haproxy-1.0.1.0 · System.IO.Streams.Network.HAProxy