happstack-server-6.5.6: Web related tools and services.

Happstack.Server.Proxy

Description

Support for creating a proxy or reverse-proxy server

Synopsis

Documentation

proxyServe :: (MonadIO m, WebMonad Response m, ServerMonad m, MonadPlus m, FilterMonad Response m) => [String] -> m ResponseSource

proxyServe is for creating a part that acts as a proxy. The sole argument [String] is a list of allowed domains for proxying. This matches the domain part of the request and the wildcard * can be used. E.g.

  • "*" to match anything.
  • "*.example.com" to match anything under example.com
  • "example.com" to match just example.com

TODO: annoyingly enough, this method eventually calls escape, so any headers you set won't be used, and the computation immediately ends.

proxyServe' :: (MonadIO m, FilterMonad Response m, WebMonad Response m) => Request -> m ResponseSource

Take a proxy Request and create a Response. Your basic proxy building block. See unproxify.

TODO: this would be more useful if it didn't call escape (e.g. it let you modify the response afterwards, or set additional headers)

rproxyServeSource

Arguments

:: (ServerMonad m, WebMonad Response m, FilterMonad Response m, MonadIO m) 
=> String

defaultHost

-> [(String, String)]

map to look up hostname mappings. For the reverse proxy

-> m Response

the result is a ServerPartT that will reverse proxy for you.

This is a reverse proxy implementation. See unrproxify.

TODO: this would be more useful if it didn't call escape, just like proxyServe'.