title: Cross-Origin Request Blocked: Azure App Service Issue
body: <p>Any Ajax / JQuery call to APP Service(<a href="http://xxxx.azurewebsites.net" rel="nofollow noreferrer">http://xxxx.azurewebsites.net</a>) throw bellow error</p>
  
  <blockquote>
    <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading
    the remote resource at
    <a href="http://api-xxx.azurewebsites.net/api/demo/1234567" rel="nofollow noreferrer">http://api-xxx.azurewebsites.net/api/demo/1234567</a>. (Reason: CORS header
    ‘Access-Control-Allow-Origin’ does not match ‘(null)’).</p>
  </blockquote>
  
  <p><strong>Point to be Noted:</strong></p>
  
  <p><strong>1.</strong> CORS set to * in Azure Portal</p>
  
  <p><strong>2.</strong> REST API also <strong>CORS</strong> Enabled. </p>
  
  <pre><code>config.EnableCors();
  </code></pre>
  
  <p><strong>CORS setting in controller level</strong></p>
  
  <pre><code>[EnableCors(origins: "*", headers: "*", methods: "*")]
  </code></pre>
  
  <p><strong>REST API Web.Config Settings</strong></p>
  
  <pre><code>&lt;httpProtocol&gt;      
  &lt;customHeaders&gt;       
   &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;     
   &lt;/customHeaders&gt;   
   &lt;/httpProtocol&gt;
  </code></pre>
  
  <p><strong>JQuery script</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;     
          $(document).ready(function () {            
              $("#b1").click(function () {               
                  var jsondata = $('#s1').text();
                  $.ajax({
                      url: "http://api-xxx.azurewebsites.net/api/demo/1234567",
                      type: "POST",
                      data: JSON.stringify(jsondata),
                      dataType: 'json',
                      async: false,
                      success: function (result) {
                          $("#div1").html(result);
                      },
                      error: function (error) {
                          //$("#div1").html(error);
                          console.log("Something went wrong", error);
                      }                
                  });
  
                  console.log(JSON.stringify(jsondata));
              });
          });
  </code></pre>