Haskell based redirector server for A/B testing (built on Parsec monadic parser combinator)
HHydra is a standalone redirector server primary for complicated A/B testing. It uses special DSL to configure its redirections.
-
Compile it:
cabal install
-
Run it:
HHydra
HHydra listens to port 9000 by default and uses ./config file for configuration.
Each line of ./config file follows this rule:
NAME <EXPRESSION[,EXPRESSION...]> [ADDRESS[,ADDRESS...]]
Where:
NAME is a rule name. It should not contain spaces.
EXPRESSION is a rule in reverse Polish notation. It can be templated using the following syntax: #{Header-name}
. Supported operations are =~
(match by regexp) and ==
(strict match).
ADDRESS is http address to redirect
chr <#{User-Agent} Chrome =~> [http://chrome.ru]
jr <#{Path} locale=en =~> [http://jetradar.com]
ab <#{Path} /new/ab =~, #{Path} /new =~> [http://a.search.aviasales.ru, http://b.search.aviasales.ru]
zx <#{Path} / =~> [http://ya.ru]
How to make a sandbox:
cabal sandbox init
cabal install --only-dependencies
cabal install
HHydra
(add ~/.cabal/bin to your $PATH to run it w/o prefix)
Look http://www.haskell.org/cabal/users-guide/ for more info.