在localhost转发代理webrick,瘦,独angular兽到外部host.com/http-bind

我工作在一个rails项目,我需要一个/ http-bind代理,无法find任何关于这个,或find一个资源来说明这是可能的。 我需要在开发环境中的这个前进知道它可能使用独angular兽+ nginx转发代理与独angular兽,但即时通讯寻找一个简单的快速方法,在我的开发环境中做到这一点…所以,是独angular兽,薄,或webrick能够做一个http-bind代理转发?

* host.com/http-bind ( xmpp http-bind ) already running * localhost:3000 THIN server posts to /http-bind returns a 404 not found currently nothing mapped. 

有可能转发的stream量

 http://localhost:3000/http-bind 

 my external http://host.com/http-bind ? 

像thin和webrick这样的服务器对于原型devise来说是非​​常棒的,独angular兽和乘客都是很棒的应用服务器,但是它们并不是devise成function全面的Web服务器。 对于这种事情,你真的应该使用一个真正的networking服务器(例如apache或nginx与乘客),因为它提供了足够的灵活性来做这些types的redirect和其他复杂的configuration,你将需要在生产中。

你可以很容易的把nginx扔在薄的前面; 它会在端口80上回答,代理请求在端口3000上进行精简。最小的示例configuration可能如下所示 :

 upstream thin { server 127.0.0.1:3000; } server { listen 80; server_name .example.com; access_log /var/www/myapp.example.com/log/access.log; error_log /var/www/myapp.example.com/log/error.log; root /var/www/myapp.example.com; index index.html; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; try_files $uri $uri/ @ruby; } location @ruby { proxy_pass http://thin; } } 

然后,你可以添加一个location , 像这样的波什:

  location /http-bind/ { proxy_buffering off; tcp_nodelay on; keepalive_timeout 55; proxy_pass http://xmpp.server:5280/xmpp-httpbind/; }