This module contains a simple HTTP and HTTPS proxy. In the most basic setup, the caller specifies a port and runs it as follows:
-- Run a HTTPS and HTTPS proxy on port 3128. import Network.HTTP.Proxy main :: IO () main = runProxy 3128
- runProxy :: Port -> IO ()
- runProxySettings :: Settings -> IO ()
- data Settings = Settings {
- proxyPort :: Int
- proxyHost :: String
- proxyOnException :: SomeException -> IO ()
- proxyTimeout :: Int
- proxyRequestModifier :: Request -> IO Request
- defaultSettings :: Settings
- data Request = Request {
- requestMethod :: Method
- httpVersion :: HttpVersion
- rawPathInfo :: ByteString
- rawQueryString :: ByteString
- serverName :: ByteString
- serverPort :: Int
- requestHeaders :: RequestHeaders
- isSecure :: Bool
- remoteHost :: SockAddr
- pathInfo :: [Text]
- queryString :: Query
- requestBody :: Source IO ByteString
- vault :: Vault
Documentation
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.
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 }
Settings | |
|
defaultSettings :: SettingsSource
The default settings for the Proxy server. See the individual settings for the default value.
data Request
Information on the request sent by the client. This abstracts away the details of the underlying implementation.
Request | |
|