Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

* ( 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 ? 
share|improve this question
up vote 1 down vote accepted

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;

    access_log /var/www/;
    error_log  /var/www/;
    root       /var/www/;
    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/;
share|improve this answer
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 '12 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. – Michael Hampton Sep 12 '12 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 '12 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. – Michael Hampton Sep 12 '12 at 7:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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