title: Express.js CORS configuration, PUT does not work?
body: <p>I have a React application and Nodejs(Express) in the Backend. After deploying to the host server, The function I did for updating some documents stop working properly. It gives the CORS error: </p>
  
  <p><a href="https://i.stack.imgur.com/fEUGB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fEUGB.png" alt="enter image description here"></a></p>
  
  <p>I have this line of code to handle CORS policy in my server.js:</p>
  
  <pre><code>app.use((req, res, next) =&gt; {
    res.set({"Access-Control-Allow-Origin" : "*", 
             "Access-Control-Allow-Methods" : "HEAD, OPTIONS, GET, POST, PUT, PATCH, DELETE", 
             "Access-Control-Allow-Headers" : "Content-Type, Authorization, X-Requested-With"})
    next();
  });
  </code></pre>
  
  <p>It is ok for GET and POST methods but does not work for PUT (Don't know if Delete works haven't tried)</p>
  
  <p>I am on this issue for plenty of time; tried this: <a href="https://stackoverflow.com/a/42463858/11896129">https://stackoverflow.com/a/42463858/11896129</a></p>
  
  <p>looked for a bunch of solutions on the net, tried to configure it from IIS web.config file, nothing resolve my problem. Which part may I miss?</p>