title: Nginx receive post request from client server then pass request and client ip to backend specific url
body: <p>I'm receiving post request from client server where it comes in with some post data and then be saved to database after being passed to my server which is running nginx, I don't know exactly how to configure Nginx to receive those request and foward them to application backend using specific url where I will be able to save them in database. I would like nginx to give the client ip address and the posted request.</p>
  
  <p>Thank you, Im still learning how to use Nginx properly.</p>
  
  <p>Here is what i have tried to do but no success</p>
  
  <pre><code>server{
    listen 80;
      server_name my_server_ip;
      error_log /var/log/nginx/error.log;
      # proxy_pass_header Server;
  
     location / {
  
             proxy_pass http://127.0.0.1:8000;
             proxy_set_header X-Forwarded-Host  $server_name;
             proxy_set_header X-Real-IP         $remote_addr;
  
           }
  
         location /user/user_request/{
             if ($request_method != 'POST'){
               return 405;
            }
  
            return 200;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            keepalive_requests 10;
            keepalive_timeout 75s;
            proxy_pass http://my_server_ip$request_uri;
      }
  
  
  }
  </code></pre>