title: nginx does not forward POST data to uwsgi -- [UPDATE] flask does not read post data
body: <p>I have a very peculiar problem with a very simple setup.</p>
  
  <p>The setup has nginx web server deployed for serving some static pages. Also it has a backend uwsgi deamon for handling POST requests.</p>
  
  <p>My nginx location configuration is as follows</p>
  
  <pre><code>#For handling POST Request
  location  = / {
  #              index index.html;
  #               autoindex on;
  
                  uwsgi_pass unix:/tmp/uwsgi.sock;
                  include uwsgi_params;
  }
  
  #For handling static page requests under /custpages
  location ^(/custpages).*(\.html) {
  
                  autoindex off;
  
   }
  </code></pre>
  
  <p>When I deploy this server and issue post requests from my browser the nginx is not sending the POST data to uwsgi. </p>
  
  <p>But interestingly , when I issue a standalone POST request using python requests, it works as expected.</p>
  
  <p>I am wondering, whats wrong with the browser based POST request compared to the standalone request, as both are going through the nginx.</p>
  
  <p>Any pointers ?</p>
  
  <p>Thanks in advance</p>
  
  <p><strong>[UPDATE]</strong></p>
  
  <p>This seems to be an issue with uwsgi. 
  For POST sent from python requests it returns the POST data as I can see the response bytes in the uwsgi log.</p>
  
  <p>But for request sent from browser the response bytes is zero.</p>
  
  <p>In both cases teh uwsgi is receiving the proper POST data from nginx so it seems this is something to do with uwsgi</p>
  
  <p><strong>[UPDATE 2]</strong></p>
  
  <p>Further update. This issue has nothing to do with nginx or uwsgi.</p>
  
  <p>I am using python with the flask microframework for my server backend application and the problem is something like this.</p>
  
  <p>I use the current request context objectto read POST data as follows
  data_string =  request.data</p>
  
  <p>Now , as it turns out, request.data is empty when the POST is issued from browser
  When POST is issued from python requests then request.data contains the proper POST data.</p>
  
  <p>So , any flask nerds out there, plz help me with this</p>