How to enable Cross Origin Resource Sharing (Ubuntu 16.04) ?

Apache Server :- Add below code to your .htaccess file to enable cross origin resource sharing and then restart apache.

<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin “*”
Header append Vary User-Agent env=!dont-vary

Modifying headers requires the use of mod_headers. Make sure to enable Mod_headers in apache using the below command :-

$ sudo a2enmod headers

Leave a Reply