Guest User

Untitled

a guest
Oct 19th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. # proxy.rb.erb
  2. require 'em-proxy'
  3.  
  4. # @emproxy_port - the port we want this process receiving traffic on (ex: 8080)
  5. # @nginx_port - the port that normally processes traffic that we are now duplexing (ex: 81)
  6. # @proxy_ip - the IP address we are duplexing to (ex: 10.10.10.10)
  7. # @proxy_port - the port that we are duplexing to (ex: 80)
  8.  
  9. Proxy.start(:host => "0.0.0.0", :port => <%= @emproxy_port %>) do |conn|
  10. conn.server :self, :host => '127.0.0.1', :port => <%= @nginx_port %>
  11. conn.server :proxy, :host => '<%= @proxy_ip %>', :port => <%= @proxy_port %>
  12. conn.on_data do |data|
  13. data
  14. end
  15. conn.on_response do |server, resp|
  16. resp if server == :self
  17. end
  18. end
Add Comment
Please, Sign In to add comment