Nginx removes file from POST request

I’m having application with react.js and react-native front-ends and node.js backend. I’m trying to dockerize it and put Nginx docker in between. Basic configuration works fine for most of the API calls, except those having files attached in post request.

On the client side I’m appending image as ‘file’ to FormData and sending it as post request, e.g.:

        const formData = new FormData();
        formData.append('file', image);
        formData.append('orderType', 'newrx');
        formData.append('instructions', instructionsText);
        formData.append('pickupDate', pickupDate);

...
        const headers = {
          headers: {
            'content-type': `multipart/form-data; boundary=${formData._boundary}`,
          }
        }
        return Axios.post(`/api/v1/orders/user/${userId}/new`, formData, headers);

On the backend side I’m using multer:

const storage = multer.memoryStorage();
const upload = multer({storage: storage,
limits: {fieldSize: 200 * 1024 * 1024}});

router.route('/api/v1/orders/user/:userId/new')
    .post(upload.single('file'), orderCtrl.createNewRx)

 ...
 const file = req.file;
    if (file) {
     ...
    } else {
      res.status(400).json({error: 'File is mandatory'});

    }

Initially, I was getting errors related to nginx buffer and body size which I was able to resolve by adding

client_max_body_size 200M;
client_body_buffer_size 200M;

but now, I’m not having any error from nginx. Requests are going through, but on the backend side there is no file attached to request.

My nginx configuration looks like this:

upstream client {
  server client:3000;
}

upstream api {
  server api:5000;
}

server {
  listen 80;

  location / {
    proxy_pass http://client;
  }

  location /sockjs-node {
    proxy_pass http://client;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
  }

  location /api {
    client_max_body_size 200M;
    client_body_buffer_size 200M;
    proxy_pass http://api;
  }
}

Source: Docker Questions