Im working on an rails project where I need a /http-bind proxy and unable to find anything about this, or find a resource to state this is possible. I need this forward in a development environment Know its possible to use unicorn + nginx to forward the proxy with unicorn BUT im looking for a simple fast way to do it locally in my development environment.... So, is unicorn, thin, or webrick capable of doing a http-bind proxy forward?

* 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.

Would it be possible to forward the traffic of



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

1 Answer 1


Servers like thin and webrick are great for prototyping, and unicorn and passenger are great application servers, but they are not designed to be full featured web servers. For this sort of thing you really should use an actual web server (e.g. apache or nginx with passenger) as it provides enough flexibility to do these sorts of redirects and other complex configurations you'll need in production.

You can pretty easy throw nginx in front of thin; it would then answer on port 80 and proxy requests to thin on port 3000. A minimal sample config might look like:

upstream thin {
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;

You could then add a location for bosh something like this:

    location /http-bind/ {
        proxy_buffering off;
        tcp_nodelay on;
        keepalive_timeout 55;
        proxy_pass http://xmpp.server:5280/xmpp-httpbind/;
  • thanks, yes I have this setup in my production environment. And would rather not set this up locally also. The idea was to simply forward proxy the traffic without to much hassle. I shall modify my question its to vague
    – Rubytastic
    Sep 12, 2012 at 7:19
  • If at all possible, you should set up your development environment to match production as closely as you can. Otherwise you end up having to debug things that break when you move from your development machine to staging/production since the environments are different. Sep 12, 2012 at 7:25
  • agree only this involves a full xmpp stack and lots of serverside specific configuration wich im not willing to replicate locally. the idea is to connect to the remote XMPP server, thats the goal of this. So I can test the client code inside a prototype rails app ( wich is only a small portion to be integrated in my existing full rails application lateron )
    – Rubytastic
    Sep 12, 2012 at 7:27
  • I still think you'll have to setup nginx or something to get that far; even unicorn is an app server and not a web server. Sep 12, 2012 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.