title: CORS issue in Azure API Management
body: <p>I'm using Azure API management which internally access my python Flask web service. Azure API works good for GET operations. For POST, when I make jquery AJAX call, the request is converted into OPTIONS and the following error shows up</p>
  
  <pre><code>No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://domain.com' is therefore not allowed access. The response had HTTP status code 500.
  </code></pre>
  
  <p>I have added the following policy for the Azure API,</p>
  
  <pre><code>&lt;policies&gt;
      &lt;inbound&gt;
          &lt;cors&gt;
              &lt;allowed-origins&gt;
                  &lt;origin&gt;*&lt;/origin&gt;
              &lt;/allowed-origins&gt;
              &lt;allowed-methods&gt;
                  &lt;method&gt;*&lt;/method&gt;
              &lt;/allowed-methods&gt;
              &lt;allowed-headers&gt;
                  &lt;header&gt;*&lt;/header&gt;
              &lt;/allowed-headers&gt;
          &lt;/cors&gt;
          &lt;base /&gt;
      &lt;/inbound&gt;
      &lt;outbound&gt;
          &lt;base /&gt;
      &lt;/outbound&gt;
  &lt;/policies&gt;
  </code></pre>
  
  <p>But still I'm facing the same issue.</p>
  
  <p>The same error showed up when I directly make AJAX POST request to my python flask service and I fixed it by adding the following code in the flask,</p>
  
  <pre><code>@app.after_request
  def after_request(response):
    response.headers.add('Access-Control-Allow-Origin', '*')
    response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
    response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE')
    return response
  </code></pre>
  
  <p>What should I change in Azure API management to get the POST operation working??</p>