I do apologize if the question seems to be a newbie one but I am very uncomfortable with this subject and don't really understand what I am trying to do. That's the reason why I am calling for a little help on this, please.
I have to deal with an existing HTML5 application which does GET requests to a LiveCode script (CGI mode with Apache on Linux).
For that I have to enable CORS and like it is described on its web site, I have tried to add this in the <Directory> directive and even in a .htaccess file
Code: Select all
Header set Access-Control-Allow-Origin "*"
I would translate that in LiveCode like this :Code: Select all
// Enable CORS (http://enable-cors.org/server_php.html) header('Access-Control-Allow-Origin: *'); // Access-Control headers are received during OPTIONS requests if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); exit; }
Code: Select all
put header "Access-Control-Allow-Origin: *"
if $_SERVER['REQUEST_METHOD'] = "OPTIONS" then
if $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] is not empty then
put header "Access-Control-Allow-Methods: GET, POST, OPTIONS"
end if
if $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'] is not empty then
put header "Access-Control-Allow-Headers: " & $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']
end if
end if
Many thanks