HTTP code 400

I am using Drupal with the Piwik Web Analytics module and when saving the configuration I am getting

/statz/piwik.php failed with error “Bad Request” (HTTP code 400).

Now the oddd thing is that I get the same error from an existing site that is runnng and delivering data to the piwik instalation

Are there any permissions I should check, what permission should index.php be?

If I go to the url/ ~ /statz/piwik.php I see a page with - Piwik is a free/libre web analytics that lets you keep control of your data.


Hi people.

i have the same problem after upgrade 2.12.1 to 2.13.1

when i browse https:url~/index.php it works, but when i browse https:url~/piwik.php an error 400 show up, only on IE.

if i browse piwik.php using chrome or Firefox it works as usually, but the statics doesn’t work since upgrade.

any Idea?

My mistake,

the statistics are working fine.

the error is just the code http 400 browsing https://~/piwik.php on IE. Firefox and Chrome show up “Piwik is a free/libre web analytics that lets you keep control of your data.” message

this happened after upgrade.

I tried chmod 777 for the file butthat did not work.

I am not sure when it happened as I only just noticed it. It does not seem to break anything else, I can still log in and see stats etc

Has anyboldy else had this problem and managed to fix it?

I am using the module on a Drupal web site that is giving me problems, I am sure this is after a piwik update, so what changed? The module still produces stats for the sites that are already installed, but even they give them same problem if I try and re save the configuration

I have just tested the piwik module in a Wordpress site and it connects and works.

To get round the problem at the moment I have added the piwik tracking code to the drupal site rather than using the module and will report the bug to the drupal module team.

I can confirm the problem since the update from version 2.12.1 to 2.13.1.

A request to directly to /piwik.php will create a HTTP Code 400 / Bad request but the output “Piwik is a free/libre web analytics that lets you keep control of your data.” will be shown. It seems to be a software-bug and that is not a proper handling of the status-codes. A positive request should be answered with a status code 200.

Requests with parameter like /piwik.php?idsite=1&rec=1 are working fine.
So the tracking is working.

Anyway, we are using the page /piwik.php for health-checking, because the content doesn’t change so often.

I suggest you will fix the problem and maybe you will create an extra site for monitoring purpose.
I hope you can fix this bug soon because I want to install the update to close the XSS-bug.

PS: I guess the bug is saved in the database because a rollback of only the webfiles doesn’t solve the problem. A had to import a database-dump to restore a functional version of 2.12.1.

Hi everyone,

We have fixed this issue and it should work correct if you use Piwik 2.14.0-b1: I would like to test early beta and RC releases, how do I enable automatic updates to use these development versions? - Analytics Platform - Matomo

It was fixed in: piwik.php is returning 400 · Issue #7850 · matomo-org/piwik · GitHub and If a GET piwik.php is done without any parameter, still return a HTTP 200 by tsteur · Pull Request #7858 · matomo-org/piwik · GitHub

Thanks but when will it be included in a stable version?

It will be next week, the beta 9 is almost the stable version.

Btw we have made official that we now document HTTP status code changes in the Developer changelog, see the issue at: Developer Changelog and documenting changes in the Piwik Platform · Issue #8127 · matomo-org/piwik · GitHub

Hello, why is a HEAD-request not allowed?

Concerning Error 400 there are 2 changes In the changelog:

Piwik 2.13.0 - Breaking Changes
piwik.php does now return a HTTP 400 (Bad request) if requested without any tracking parameters (GET/POST). If you still want to use piwik.php for checks please use piwik.php?rec=0.

Piwik 2.9.1 - Breaking Changes
The HTTP Tracker API does now respond with a HTTP 400 instead of a HTTP 500 in case an invalid idsite is used

Nevertheless with the version 2.14.3 I get an error 400 even when sending some parameters in the url. In the source (without debugging version) it’s a bit hard to track it down, seems I’ve to install the debug version.
Or has someone a hint for me?

@dbruchmann please create a bug report on Github with more info

Also see: Tracking HTTP API: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

In case someone finds this this issue searching for 2.15.0 upgrade problems, I posted our solution here.