title: Can't send PUT Request because of Access-Control-Allow-Methods in preflight response
body: <p>I know, that this is a really common topic and I already have checked many of the questions on stackoverflow. But my case is a kind of different, because I don't get the problem. Basically, I know how to handle CORS, and I already tried many solutions.</p>
  
  <p>Let me explain the situation:</p>
  
  <p>My setup is an Ionic project (on localhost), that sends via http request an PUT to my self hosted Directus Headless-CMS. GET and POST work perfectly.
  When I try the request via Postman, it works very well. I know that Postman sends automatically additional headers within its request. I tried to add them in my code as well, but still the same respone message.</p>
  
  <p>This is my response code snippet within Ionic </p>
  
  <pre><code>  var jsonbody = {};
    jsonbody['german'] = "lorem ipsum";
    jsonbody['turoyo'] = "lorem ipsum";
    jsonbody['description'] = "lorem ipsum";
    console.log(jsonbody);
  
    this.http.put('http://example.com/api/1.1/tables/translation/rows/1?access_token=myaccesstoken', jsonbody, {headers: headers})
      .subscribe(
        (response) =&gt; {
          //foo
        },
        (error) =&gt; {
          //bar
        },
        () =&gt; {
          //foobar
        }
      );
  </code></pre>
  
  <p>In my browser console I get this message after trying the request:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load <a href="http://example.com/api/1.1/tables/translation/rows/1?access_token=myaccesstoken" rel="nofollow noreferrer">http://example.com/api/1.1/tables/translation/rows/1?access_token=myaccesstoken</a>. Method PUT is not allowed by Access-Control-Allow-Methods in preflight response.</p>
  </blockquote>
  
  <p>In Postman, it works like a breeze. Look</p>
  
  <p><a href="https://i.stack.imgur.com/pbPNF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pbPNF.png" alt="enter image description here"></a></p>
  
  <p>You also have the possibility in Postman to generate the according code snippet for that request. In this case it's:</p>
  
  <p><a href="https://i.stack.imgur.com/nH9JA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nH9JA.png" alt="enter image description here"></a></p>
  
  <p>Anybody an idea what I did wrong? Maybe I just missed a detail. I also tried to add headers to my nginx sites-enabled configuration. But that didn't make a difference. But that makes no sense to me, because Postman did send the request.</p>
  
  <p>Thanks!</p>