Cocos creator network cogs porblem

Nowadays our team try to make Rpg game by using cocos creator.

I think this engine is awesome. Because I think by using this we can make whatever we want to make.

But I got a problem few days ago, and i can’t solve this.

it is called “Control-Allow-Origin”

when I use “XMLHttpRequest” in cocos creator to access in our ranking server,

it show me error

No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:7456’ is therefore not allowed access. (it is only occured in website)

by searching this problem I could know it is due to chrome network policy. and yet I couldn’t find any source to solve this problem.

does anyone know how can i solve this problem? if it is not solvable we can’t use any server when making cocos-creator game…

thx

on your ranking server must add these to header

AllowAllOrigins: true,
AllowMethods:    "GET", "POST", "PUT", "DELETE", "OPTIONS"
AllowHeaders:    "Origin", "Content-Type", "x-access-token", "Access-Control-Allow-Origin"
ExposeHeaders:   "Content-Length", "Access-Control-Allow-Origin"

Actually I use aws lambda sever and using node js. Is it possible to use that header in node js? And if possible do you know some example to excute that thing…? Thank you very much

it’s possible but i’m don’t know nodejs. it’s something like ‘express cors middleware’