Losing POST data on vanilla Ubuntu/nginx/mongrel install

Aaron Starr astarr at wiredquote.com
Sat Apr 4 01:22:43 MSD 2009


Hi, all. Sorry in advance for what is hopefully a simple question.

I'm using nginx as a reverse-proxy for a few mongrel instances. Using
AJAX (XMLHttpRequest), I POST a small bit of JSON to the server. The
request is properly proxied to mongrel, but with the POST data
missing!

(I.e., in the rails controller, request.env['RAW_POST_DATA'] and
reqest.raw_post are empty.)

When I take nginx out of the mix, by POSTing directly to mongrel, it
works fine. And, it was working fine before when going through nginx,
but some mysterious change happened in the last couple of days, and
now I usually see the problem.

Anyone have any ideas?


Versions:

mongrel 1.1.5
mongrel cluster 1.0.5
nginx 0.7.9
Ubuntu 8.04.1

Configuration:

user www www;
worker_processes 1;

error_log logs/error.log error;
pid        /var/run/nginx.pid;

events {
  worker_connections 1024;
}

http {
  include mime.types;
  default_type application/octet-stream;
  access_log logs/access.log;

  sendfile on;
  #tcp_nopush on;
  keepalive_timeout 65;
  tcp_nodelay on;

  gzip on;
  gzip_min_length 1100;
  gzip_buffers 4 8k;
  gzip_types text/plain text/javascript application/x-javascript;

  upstream mongrel {
    server 127.0.0.1:3000;
    server 127.0.0.1:3001;
    server 127.0.0.1:3002;
    server 127.0.0.1:3003;
    server 127.0.0.1:3004;
  }

  server {
    listen 80;
    server_name wiredquote.com;
    root /opt/apps/benefits/public;
    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 false;
      if (-f $request_filename) {
        break;
      }
      if (-f $request_filename/index.html) {
        rewrite (.*) $1/index.html break;
      }
      if (-f $request_filename.html) {
        rewrite (.*) $1.html break;
      }
      if (!-f $request_filename) {
        proxy_pass http://mongrel;
        break;
      }
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
      root   html;
    }
  }
}





More information about the nginx mailing list