featureflags icon indicating copy to clipboard operation
featureflags copied to clipboard

CORS issue : OPTIONS call is returning 405

Open mhmahmoodalam opened this issue 7 years ago • 0 comments

During preflight request OPTIONS call is returning 405 launchdarklycorserror . You could try to add below code to any React Component to reproduce it. The URL should be require authorization and call should be made from outside launch-darkly domain( for preflight validation to work).

The document says i need to add below two for authenticated CORS:

  • AuthoricationKey
  • withCredentials : true

componentDidMount() { const response = fetch('https://URL', { method: 'GET', headers: new Headers({ Authorization: API_KEY,
'Content-type': 'application/json' }), credentials: 'include'
}); if (response.ok) console.log( response.json());
}

mhmahmoodalam avatar Dec 22 '18 05:12 mhmahmoodalam