http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "X-Requested-With,Content-Type,Content-Length,X-User"

------------------------------------------------------------------------------------
php实例

            $host = $_SERVER['HTTP_HOST'];
$origin = $_SERVER['HTTP_ORIGIN'];

header("Access-Control-Allow-Origin:{$origin}"); //设置允许跨域访问
header('Access-Control-Allow-Credentials:true'); //表示是否允许发送Cookie。默认情况下,Cookie不包括在CORS请求之中。设为true,即表示服务器明确许可,Cookie可以包含在请求中,一起发给服务器。
header("Access-Control-Allow-Headers: X-Requested-With,X_Requested_With"); //设置允许的跨域header