No 'Access-Control-Allow-Origin'


#1

Hello,

I’m trying to make requests to Piwik API via Ajax but Piwik doesn’t set ‘Access-Control-Allow-Origin’ field in header.
I modified config.php.ini and added cors_domains[] = * but nothing changed.
What could be wrong?

Thanks in advance
Alessandro


#2

This is a cross-domain problem, I don’t know what document format you used for your Piwik API, if you use JSON, there is a easy solution by using JSONP to fix this problem. Otherwise, you must enable CORS service, to enable this service,
If you do have access to your Apache server, check out this link:
http://enable-cors.org/server_apache.html
If you do not have access to the server, try this way,
http://enable-cors.org/server_php.html


#3

I’ll check apache modules


#4

I forced header to set Access-Control-Allow-Origin field via apache directive for now, but Piwik should send this header via php however, and if it doesn’t, there’s a bug somewhere!


(Matthieu Aubry) #5

Hi there,

a bug was fixed recently and is available in latest beta: I would like to test early beta and RC releases, how do I enable automatic updates to use these development versions? - Analytics Platform - Matomo
this should work now!


#6

I got the latest version of Piwik 2.13 installed, no beta available, but it doesn’t work for me.

I followed the instructions in the Piwik documentation:

How do I configure my Piwik server to allow cross domain requests? (CORS)
http://piwik.org/faq/how-to/faq_18694/

But it’s still not working for me.


(Matthieu Aubry) #7

What is the content of your config.ini.php ?

You verified that the CORS headers are not sent in piwik responses?