http-proxy-0.0.1: A library for writing HTTP and HTTPS proxies



This module contains a simple HTTP and HTTPS proxy. In the most basic setup, the caller specifies a port and runds it as follows:

 -- Run a HTTPS and HTTPS proxy on port 3128.
 import Network.HTTP.Proxy

 main :: IO ()
 main = runProxy 3128



runProxy :: Port -> IO ()Source

Run a HTTP and HTTPS proxy server on the specified port. This calls runProxySettings with defaultSettings.

runProxySettings :: Settings -> IO ()Source

Run a HTTP and HTTPS proxy server with the specified settings.

data Settings Source

Various proxy server settings. This is purposely kept as an abstract data type so that new settings can be added without breaking backwards compatibility. In order to create a Settings value, use defaultSettings and record syntax to modify individual records. For example:

 defaultSettings { proxyPort = 3128 }




proxyPort :: Int

Port to listen on. Default value: 3100

proxyHost :: String

Host to bind to, or * for all. Default value: *

proxyOnException :: SomeException -> IO ()

What to do with exceptions thrown by either the application or server. Default: ignore server-generated exceptions (see InvalidRequest) and print application-generated applications to stderr.

proxyTimeout :: Int

Timeout value in seconds. Default value: 30

defaultSettings :: SettingsSource

The default settings for the Proxy server. See the individual settings for the default value.