Skip to content

Instantly share code, notes, and snippets.

@ehlertij
Created June 8, 2012 18:26
Show Gist options
  • Save ehlertij/2897415 to your computer and use it in GitHub Desktop.
Save ehlertij/2897415 to your computer and use it in GitHub Desktop.
em-proxy proxy.rb
# /data/ngin/shared/proxy/proxy.rb
require 'em-proxy'
Proxy.start(:host => "0.0.0.0", :port => EMPROXY_PORT) do |conn|
conn.server :self, :host => '127.0.0.1', :port => NGINX_PORT
conn.server :proxy, :host => PROXY_IP, :port => PROXY_PORT
conn.on_data do |data|
data
end
conn.on_response do |server, resp|
resp if server == :self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment