Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # proxy.rb.erb
- require 'em-proxy'
- # @emproxy_port - the port we want this process receiving traffic on (ex: 8080)
- # @nginx_port - the port that normally processes traffic that we are now duplexing (ex: 81)
- # @proxy_ip - the IP address we are duplexing to (ex: 10.10.10.10)
- # @proxy_port - the port that we are duplexing to (ex: 80)
- 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
Add Comment
Please, Sign In to add comment