Skip to content

Instantly share code, notes, and snippets.

@lfborjas lfborjas/proxy.ru
Created Sep 10, 2011

Embed
What would you like to do?
Simple proxy server for developing front-ends for APIs (using rack middleware)
require 'rack'
require 'rack/proxy' #gem install rack-proxy
class Proxy < Rack::Proxy
def rewrite_env(env)
env["HTTP_HOST"] = "my.host.com"
env["SERVER_PORT"] = "80"
env
end
end
#serve static assets, your frontend
use Rack::Static, :urls => {"/" => "index.html"}
use Rack::Static, :urls => ["/css", "/images", "/js"]
run Proxy.new
#thin --rackup proxy.ru start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.