Provides a simple means of reverse-proxying HTTP requests. The raw approach
uses the same technique as leveraged by keter, whereas the WAI approach
performs full request/response parsing via WAI and http-conduit.
Raw example
The following sets up raw reverse proxying from local port 3000 to
www.example.com, port 80.
{-# LANGUAGE OverloadedStrings #-}
import Network.HTTP.ReverseProxy
import Data.Conduit.Network
main :: IO ()
main = runTCPServer (serverSettings 3000 "*") $ \appData ->
rawProxyTo
(\_headers -> return $ Right $ ProxyDest "www.example.com" 80)
appData
Changes
0.5.0
update wpsProcessBody to accept response’s initial request
0.4.5
add Eq, Ord, Show, Read instances to ProxyDest
0.4.4
add rawTcpProxyTo which can handle proxying connections without http headers
#21
0.4.3.3
fixReqHeaders may create weird x-real-ip header #19
0.4.3.2
Minor doc cleanup
0.4.3.1
Use CPP so we can work with http-client pre and post 0.5 #17