Nginx proxy to swiftiply problems

Hi,

I’m trying to setup nginx to proxy requests to a swiftiply server. I am
having some issues with the sub domains. Let me explain my setup :

I have 2 servers (physical) :

  • NginxServer :

runs nginx; gets incoming requests and forwards them to SwiftiplyServer
(when necessary)

  • SwiftiplyServer :

runs swiftiply with different swiftiplied mongrels applications. These
application are accessed with these uris (
application1.myswiftserver.com, application2.myswiftserver.com, etc. )

When I access my SwiftiplyServer directly, everything works fine; I get
served the right application. But when I go through Nginx, I always get
served the default application (the one swiftiply is configured to serve
when it does not find any matching applications). Its like if nginx does
not pass the “application1” part of the uri to swiftiply.

Here is my nginx config for proxying :

upstream swiftiply {
server myswiftserver.com:80;
}

server {
listen 80;
server_name localhost;

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 false;
proxy_max_temp_file_size 0;

proxy_pass http://swiftiply;
  break;
}

}
}

Thank you