Docker image don't have Access-Control-Allow-Origin header for matomo.js

I’m using https://hub.docker.com/_/matomo/ and it looks like matomo.js is served as static file without handling cors headers.

To fix (hack) this I had to:

  1. Enable Apache Header mod: a2enmod headers && service apache2 restart
  2. Add .htaccess with:
<FilesMatch "(matomo\.js)$">
    Header set Access-Control-Allow-Origin "*"
</FilesMatch>

Unfortunately this not handle whitelist from matomo admin configuration