title: Getting CORS error as per below in Microsoft Edge browser while calling azure search api from my custom application
body: <p>I have a WebApp hosted in azure and Azure AD is used for authentication and i am am able to login to the application. But while calling a Azure Search Service api i am getting CORS  error as per below only in MS Edge browser in chrome and IE its working fine.</p>
  
  <p>I have tracked the network and below is my observation:
  When the Azure search service API is called its redirecting to Azure AD authentication and the CORS error is thrown but this rediection is not happening in chrome or IE so no issue in these browsers.</p>
  
  <p>I have already configured my  site url to Azure AD  and i guess i can't modify the response header of the AD, then how to overcome this issue. </p>
  
  <p>(Note:
  1. I have added the CORS url in azure search as well as web app as well as while calling search api.
  2. I am not getting this error in chrome or IE)</p>
  
  <p>Error Message:
  SEC7120: [CORS] The origin '<a href="https://mysiteurl.com" rel="nofollow noreferrer">https://mysiteurl.com</a>' did not find '<a href="https://mysiteurl.com" rel="nofollow noreferrer">https://mysiteurl.com</a>' in the Access-Control-Allow-Origin response header for cross-origin  resource at '<a href="https://login.windows.net/ea80952e-a476-42d4-aaf4-5457852b0f7e/oauth2/authorize?response_type=code+id_token&amp;redirect_uri=https%3A%2F%2Fmysiteurl.com%2F.auth%2Flogin%2Faad%2Fcallback&amp;client_id=ca68e724-2c3d-4699-82bc-f8a56efa243a&amp;scope=openid+profile+email&amp;response_mode=form_post&amp;nonce=8c756622bc8f4b02b03adcb41fbab33b_20190108150104&amp;state=redir%3D%252Fapi%252Fsearch" rel="nofollow noreferrer">https://login.windows.net/ea80952e-a476-42d4-aaf4-5457852b0f7e/oauth2/authorize?response_type=code+id_token&amp;redirect_uri=https%3A%2F%2Fmysiteurl.com%2F.auth%2Flogin%2Faad%2Fcallback&amp;client_id=ca68e724-2c3d-4699-82bc-f8a56efa243a&amp;scope=openid+profile+email&amp;response_mode=form_post&amp;nonce=8c756622bc8f4b02b03adcb41fbab33b_20190108150104&amp;state=redir%3D%252Fapi%252Fsearch</a>'.</p>
  
  <p>My search method:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>return fetch("/api/search",
              {
                  mode: "cors",
                  headers: {
                      "api-key": searchState.config.queryKey,
                      "Access-Control-Allow-Credentials": "true",
                      "access-control-allow-origin": "https://mysiteurl.com",
                      "Content-Type": "application/json",
                      "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept"
                  },
                  method: "POST",
                  body: JSON.stringify(postBody)
              });</code></pre>
  </div>
  </div>
  </p>
  
  <p>[See the below image where i have called the search API form behind]</p>