How to enable cross-domain request on the server?

Access-Control-Allow-Origin: http://yourdomain-you-are-connecting-from.com

on target server

in php:

 header("Access-Control-Allow-Origin: http://yourdomain-you-are-connecting-from.com");

in case you don’t want to use server-scripting language: put this in (linux) console

a2enmod headers

and to your .htaccess file add ­ ­ ­ ­ ­ ­ ­

Header set Access-Control-Allow-Origin: http://yourdomain-you-are-connecting-from.com

Leave a Comment