How to set CORS header?

Fixed it by adding Header set Access-Control-Allow-Origin "*" in apache2.conf:

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
  Header set Access-Control-Allow-Origin "*"
</Directory>

tech