I have my config setup to handle a bunch of GET requests which render pixels that work fine to handle analytics and parse query strings for logging. With an additional third
I had a similar problem. GET requests worked and their (empty) request bodies got written to the the log file. POST requests failed with a 404. Experimenting a bit, I found that all POST requests were failing. I found a forum posting asking about POST requests and the solution there worked for me. That solution? Add a proxy_header
line right before the proxy_pass
line, exactly like the one in the example below.
server {
listen 192.168.0.1:45080;
server_name foo.example.org;
access_log /path/to/log/nginx/post_bodies.log post_bodies;
location / {
### add the following proxy_header line to get POSTs to work
proxy_set_header Host $http_host;
proxy_pass http://10.1.2.3;
}
}
(This is with nginx 1.2.1 for what it is worth.)