Liquid Proxy

Build status Gem Version


Http proxy that you can instruct via api to inject arbitrary headers into requests passing through.

Why? I needed it to recreate parts of live infrustructure in test environment (namely, the app under test was behind the proxy that takes care of authenticating users and passes on its checks in the form of http header).


This is a ruby gem and it requires ruby >= 1.9.2.

# Gemfile
gem 'liquid-proxy'

The following example shows usage with cucumber/capybara/selenium:

# env.rb
require 'capybara'
require 'selenium-webdriver'
require 'liquid-proxy'

LiquidProxy.start(port: 9889)

Capybara.configure do |config|
  config.default_driver = :selenium
  config.run_server     = false
  config.app_host       = ""

Capybara.register_driver :selenium do |app|
  profile       =
  profile.proxy = 'localhost:9889', type: :manual), profile: profile)

# let tests start clean
Before do

Then in step definitions you can:

# set headers to inject
LiquidProxy.headers_to_inject = {'Foo' => 'Bar', 'Accept' => 'Cash'}

# add to headers to inject
LiquidProxy.headers_to_inject['X_HACKERY'] = 'BOOM'

# clear headers to inject

Standalone usage

If you are not using ruby, it is possible to run liquid-proxy as a standalone process and controll it via REST api:

# install
bash$ gem install liquid-proxy

# start
bash$ liquid-proxy 8998

# add headers
bash$ curl --data-binary '{"Foo":"Bar","Accept":"Cash"}' http://localhost:8998

# clear headers
bash$ curl -X DELETE http://localhost:8998


Artem Avetisyan