I tried the following combinations
- Nginx + Mongrel (MRI)
- Nginx + Mongrel (Jruby)
- Nginx + Glassfish Gem
- Glassfish Gem
Basically for 1), 2) and 3) I use Nginx to service static files and
Mongrel/Glassfish to service rails with the following config
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
With 1), 2) and 4) everything works fine,
However things start to break when I do 3) which is putting Nginx in
front of Glassfish Gem.
There appears to be some redundant stuffing of HTTP Headers, which
breaks all Ajax requests. The regular HTTP Get request work fine though.
But, when I remove Nginx to access Glassfish directly, then things are
fine.
At this point, 3) is my preferred deployment because Glassfish appears
to not suffer from the memory leak that Mongrel (Jruby) does, and I need
Nginx to service all other requests on this machine.