-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Reverse proxy HTTP requests, either over raw sockets or with WAI -- -- 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. @package http-reverse-proxy @version 0.1.1.2 module Network.HTTP.ReverseProxy -- | Host/port combination to which we want to proxy. data ProxyDest ProxyDest :: !ByteString -> !Int -> ProxyDest pdHost :: ProxyDest -> !ByteString pdPort :: ProxyDest -> !Int -- | Set up a reverse proxy server, which will have a minimal overhead. -- -- This function uses raw sockets, parsing as little of the request as -- possible. The workflow is: -- --
    --
  1. Parse the first request headers.
  2. --
  3. Ask the supplied function to specify how to reverse proxy.
  4. --
  5. Open up a connection to the given host/port.
  6. --
  7. Pass all bytes across the wire unchanged.
  8. --
-- -- If you need more control, such as modifying the request or response, -- use waiProxyTo. rawProxyTo :: (MonadBaseControl IO m, MonadIO m) => (RequestHeaders -> m (Either (Application m) ProxyDest)) -> Application m -- | Creates a WAI Application which will handle reverse proxies. -- -- Connections to the proxied server will be provided via http-conduit. -- As such, all requests and responses will be fully processed in your -- reverse proxy. This allows you much more control over the data sent -- over the wire, but also incurs overhead. For a lower-overhead -- approach, consider rawProxyTo. -- -- Most likely, the given application should be run with Warp, though in -- theory other WAI handlers will work as well. -- -- Note: This function will use chunked request bodies for communicating -- with the proxied server. Not all servers necessarily support chunked -- request bodies, so please confirm that yours does (Warp, Snap, and -- Happstack, for example, do). waiProxyTo :: (Request -> ResourceT IO (Either Response ProxyDest)) -> (SomeException -> Application) -> Manager -> Application -- | Sends a simple 502 bad gateway error message with the contents of the -- exception. defaultOnExc :: SomeException -> Application waiProxyToSettings :: (Request -> ResourceT IO (Either Response ProxyDest)) -> WaiProxySettings -> Manager -> Request -> ResourceT IO Response data WaiProxySettings -- | The default value for this type. def :: Default a => a wpsOnExc :: WaiProxySettings -> SomeException -> Application wpsTimeout :: WaiProxySettings -> Maybe Int -- | Convert a WAI application into a raw application, using Warp. waiToRaw :: Application -> Application IO instance Default WaiProxySettings