snap-core-0.9.6.3: Snap: A Haskell Web Framework (core interfaces and types)

Safe HaskellNone

Snap.Util.Proxy

Description

This module provides facilities for patching incoming Requests to correct the value of rqRemoteAddr if the snap server is running behind a proxy.

Example usage:

 m :: Snap ()
 m = undefined  -- code goes here

applicationHandler :: Snap ()
 applicationHandler = behindProxy X_Forwarded_For m

Synopsis

Documentation

data ProxyType Source

What kind of proxy is this? Affects which headers behindProxy pulls the original remote address from.

Currently only proxy servers that send X-Forwarded-For or Forwarded-For are supported.

Constructors

NoProxy

no proxy, leave the request alone

X_Forwarded_For

Use the Forwarded-For or X-Forwarded-For header

behindProxy :: MonadSnap m => ProxyType -> m a -> m aSource

Rewrite rqRemoteAddr if we're behind a proxy.