1 minute read

Enable CORS from all websites

Next, add the “Header add Access-Control-Allow-Origin *” directive to either your Apache config file, or .htaccess file, or Virtual Host configuration file, depending on your requirement. If you add it to your main configuration file, CORS will be enabled to all websites on your server. If you add it to .htaccess file or virtual host configuration file, then it will be enabled for only that file’s website. Here are examples of how to add this directive in different files. You can use any one of them.

Directory Tag in Main Configuration File

Advertisement

<Directory /var/www/html> ...

Header set Access-Control-Allow-Origin "*" ...

</Directory>

This article is from: