Popularity
2.0
Declining
Activity
0.0
Declining
2
0
2

Monthly Downloads: 62
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Web     Wai    
Latest version: v0.1.1.0

wai-middleware-delegate alternatives and similar packages

Based on the "wai" category

Do you think we are missing an alternative of wai-middleware-delegate or a related project?

Add another 'wai' Package

README

wai-middleware-delegate CircleCI BSD3

wai-middleware-delegate is a WAI middleware that allows requests to be handled by a delegate application that proxies requests to another server.

Example

{-# LANGUAGE OverloadedStrings #-}

import           Data.Default                    (Default (..))
import           Network.HTTP.Client.TLS         (newTlsManager)
import           Network.HTTP.Types              (status500)
import           Network.Wai
import           Network.Wai.Handler.Warp (run)
import           Network.Wai.Middleware.Delegate (ProxySettings (..),
                                                  delegateToProxy)

sampleSettings :: ProxySettings
sampleSettings = def { proxyHost = "httpbin.org" }

-- | Create an application that proxies every request to httpbin.org
httpBinDelegate :: ProxySettings -> IO Application
httpBinDelegate s = do
  -- delegate everything!
  let takeItAll = const True
      dummyApp _ respond = respond $ responseLBS status500 [] "I should have been proxied"

  manager <- newTlsManager
  return $ delegateToProxy s manager (takeItAll) dummyApp

main :: IO ()
main = httpBinDelegate sampleSettings >>= run 3000


*Note that all licence references and agreements mentioned in the wai-middleware-delegate README section above are relevant to that project's source code only.