0

I wrote some code that takes data from a site, and sends it to me over discord webhook. I had no problems testing the code on my local machine. I then started an AWS VM and uploaded my site to there. I am now Getting CORS errors that look like this.

OPTIONS https://discordapp.com/api/webhooks/             CORS Missing Allow Origin

and

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://discordapp.com/api/webhooks/        (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

What I was able to find on the issue told me to add the "Access-Control-Allow-Origin" header and the "Access-Control-Allow-Methods" header. I added them like so (using javascript with XMLHttpRequest btw).

    xmlhttp.setRequestHeader("Access-Control-Allow-Origin", "*");
    xmlhttp.setRequestHeader("Access-Control-Allow-Methods","*");

Does anyone know a solution to this problem?

paul10510
  • 1
  • 1

0 Answers0