| Copyright | (c) 2018-2021 Tim Emiola |
|---|---|
| License | BSD3 |
| Maintainer | Tim Emiola <tim.emiola@gmail.com> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Network.Wai.Middleware.Delegate
Contents
Description
Provides a WAI middleware that delegates handling of requests.
Provides 3 combinators that create middleware along with supporting data types.
delegateTo: delegates handling of requests matching a predicate to a delegate ApplicationdelegateToProxy: delegates handling of requests matching a predicate to different hostsimpleProxy: is a simple reverse proxy, based on proxyApp of http-proxy by Erik de Castro Lopo/Michael Snoyman
Synopsis
- delegateTo :: Application -> RequestPredicate -> Middleware
- delegateToProxy :: ProxySettings -> Manager -> RequestPredicate -> Middleware
- simpleProxy :: ProxySettings -> Manager -> Application
- data ProxySettings = ProxySettings {}
- defaultSettings :: ProxySettings
- type RequestPredicate = Request -> Bool
Middleware
delegateTo :: Application -> RequestPredicate -> Middleware Source #
Create a middleware that handles all requests matching a predicate by delegating to an alternate Application.
delegateToProxy :: ProxySettings -> Manager -> RequestPredicate -> Middleware Source #
Creates a middleware that handles all requests matching a predicate by proxing them to a host specified by ProxySettings.
simpleProxy :: ProxySettings -> Manager -> Application Source #
A Wai Application that acts as a http/https proxy.
Configuration
data ProxySettings Source #
Settings that configure the proxy endpoint.
Constructors
| ProxySettings | |
Fields
| |
defaultSettings :: ProxySettings Source #
A default ProxySettings that makes simplistic assumptions, e.g, that
target host is localhost
Aliases
type RequestPredicate = Request -> Bool Source #
Type alias for a function that determines if a request should be handled by a delegate.