Hey there! This forum as been hella helpful last time I had an issue so I figured I’d seek help again.
I’m trying to send an http post request from my embed Unity WebGL game to my Wix site.
I have set my header accordingly to accept these types of request like so:
export function post_addUserLeaderboard(request) {
let options = {
"headers": {
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Headers": "Accept, X-Access-Token, X-Application-Name, X-Request-Sent-Time",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json"
}
};
But even though “Access-Control-Allow-Origin”: “*” is there my console throws me this error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://mystitename.com/_functions/addUserLeaderboard/. (Reason: CORS header “Access-Control-Allow-Origin” missing).
Is there something I am doing wrong? How can I allow my embed WebGL game to send my post request successfully?
Cheers,
Raphael