How to troubleshoot failed request due to CORS?