W whoim Member Jul 20, 2015 32 0 6 Jul 22, 2015 #1 Hello, i trying use json api from javascript. I use another domain, and browser send OPTIONS request to node. Node API not have "Access-Control-Allow-Origin" header in reply. Result - 501 method 'OPTIONS' not available What i may use api from js?
Hello, i trying use json api from javascript. I use another domain, and browser send OPTIONS request to node. Node API not have "Access-Control-Allow-Origin" header in reply. Result - 501 method 'OPTIONS' not available What i may use api from js?
W whoim Member Jul 20, 2015 32 0 6 Jul 22, 2015 #2 i added CORS header to httpserver.pm $resp->header('Server' => "pve-api-daemon/3.0"); +$resp->header('Access-Control-Allow-Origin' => "*"); +$resp->header('Access-Control-Allow-Methods' => "GET, POST, OPTIONS"); +$resp->header('Access-Control-Allow-Headers' => "X-Requested-With"); but have error OPTIONS https://x:8006/api2/json/nodes/x/qemu/x/vncproxy UI.API2Request @ pveui.js:119UI.pve_start @ pveui.js... XMLHttpRequest cannot load https://x:8006/api2/json/nodes/x/qemu/x/vncproxy. Invalid HTTP status code 501
i added CORS header to httpserver.pm $resp->header('Server' => "pve-api-daemon/3.0"); +$resp->header('Access-Control-Allow-Origin' => "*"); +$resp->header('Access-Control-Allow-Methods' => "GET, POST, OPTIONS"); +$resp->header('Access-Control-Allow-Headers' => "X-Requested-With"); but have error OPTIONS https://x:8006/api2/json/nodes/x/qemu/x/vncproxy UI.API2Request @ pveui.js:119UI.pve_start @ pveui.js... XMLHttpRequest cannot load https://x:8006/api2/json/nodes/x/qemu/x/vncproxy. Invalid HTTP status code 501