Issue #6659: Return HTTP 204 instead of GIF for JavaScript tracking

With the release 2.9.1 Issue #6659 was introduced: Return HTTP 204 instead of GIF for JavaScript tracking.

Has this been well-thought-out? The proxy script doesn’t take this into account IMO.

Now I have an entry in my PHP error log for every piwik request because
[function.file-get-contents]:
failed to open stream: HTTP request failed! HTTP/1.1 204 No Response
in piwik.php on line 75

Thank you for the report! Indeed this is regression and this shows that we didn’t yet have an automated test for this proxy script. I created an issue to fix this bug and also add a testso this proxy script does not break again in the future: Proxy script fails after piwik.php returns 204 response · Issue #6712 · matomo-org/matomo · GitHub

Hi,

It seems file_get_contents() accepts the 204 return code without problem. I have tested with PHP 5.3 and 5.6.

Which specific version of PHP are you running?

Would it be possible that you are using PHP 5.2 for running the proxy script?

I have indeed proxy scripts running on servers with PHP 5.2.17.

But anyway the 204 is for the client so shouldn’t the http status code, whatever it is, be proxied to the client as well?

Hi!

I have moved the proxy to a separate repository in the hope of making it more visible and easier to maintain: https://github.com/piwik/tracker-proxy

I have fixed the problem you reported, could you give it a try and confirm it is indeed fixed? You should download the new piwik.php (proxy) from here: https://github.com/piwik/tracker-proxy

Thanks

Installed on PHP 5.2 and it’s working okay.

Hi Matt,

Piwik2.9 version installed.

We have PHP 5.4 installed, still piwik.php returns 204 no response, because of this our application sometimes gets stalled or it takes as long as 5 min to completely load the page.

Kindly suggest.

Hi there,
Upgrade to 2.14.2 - this should fix the issue

Thanks Matt, will check.

same here: piwik.php?action_name=… Statuscode: 204 Actual Version

I’m seeing same issue in 2.16.1 :frowning:

When I access http://stats.example.com/piwik.php?site_id=1&rec=1 it returns 204. This shouldn’t be happening, right?

Any ideas?

@hgeizm it is expected, see also send_image on Tracking HTTP API: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

1 Like