matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.7k stars 2.62k forks source link

CORS issue on Wordpress site #21106

Closed p1xel007 closed 1 year ago

p1xel007 commented 1 year ago

Using Matomo On-Premise instance

I'm currently getting this issue in my Wordpress site:

Access to XMLHttpRequest at '[MATOMO DOMAIN]' from origin '[WORDPRESS DOMAIN]' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I'm using the WP-Matomo Integration wordpress plugin.

I added cors_domains[] = "*" in the setting of my Matomo instance but no luck.

Is there any way it can be solved?

sgiehl commented 1 year ago

Hi @p1xel007,

sorry to hear you are having trouble with this. It could possibly be caused by the referrer policy used by your site. Guess it's hard to tell you the reason without looking at the specific site and the used headers. But unfortunately we aren't able to give that kind of support here on GitHub. Maybe try asking you question on our forums instead.

Thanks for your understanding

p1xel007 commented 1 year ago

Hi @p1xel007,

sorry to hear you are having trouble with this. It could possibly be caused by the referrer policy used by your site. Guess it's hard to tell you the reason without looking at the specific site and the used headers. But unfortunately we aren't able to give that kind of support here on GitHub. Maybe try asking you question on our forums instead.

Thanks for your understanding

I've looked at countless forum posts with similar issues and 0 answers.

I tried to use a different Matomo instance in a different server and it worked. I think the problem is not with the site but with the compatibility between the server and the Matomo instance. How can I make sure the Matomo instance is accepting CORS requests from all origins?

sgiehl commented 1 year ago

The Matomo instance accepts all requests to the tracking endpoint. Your error above sounds more like your webpage would deny sending the request or to work with the response it receives due to the CORS settings.