Title: Empty HTTP headers added when using PHP API mode
Last modified: March 31, 2018

---

# Empty HTTP headers added when using PHP API mode

 *  [GermanKiwi](https://wordpress.org/support/users/germankiwi/)
 * (@germankiwi)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/empty-http-headers-added-when-using-php-api-mode/)
 * Hi [@braekling](https://wordpress.org/support/users/braekling/),
 * I noticed something strange when I switched the Piwik Mode from HTTP API to PHP
   API, in the plugin’s settings.
 * When it’s using PHP API, I find that there are three extra HTTP headers added
   to the page, when I read the headers using a service such as [https://redbot.org](https://redbot.org).
   The three extra HTTP headers are:
 *     ```
       Pragma:
       Expires:
       Cache-Control: must-revalidate
       ```
   
 * They appear exactly as above. In other words, the Pragma and Expires headers 
   have no value at all.
 * But when I change the plugin back to using HTTP API, these three headers disappear
   completely (which is what I consider expected behaviour – they should not be 
   there in the first place).
 * Do you have any idea why these three headers are added, when I change the Piwik
   plugin to use PHP API?
 * My Piwik installation is on the same server as WordPress, and everything else
   with the plugin works fine.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/empty-http-headers-added-when-using-php-api-mode/#post-10237909)
 * If you are using the PHP mode, some Matomo classes are included by WP-Piwik to
   handle the connection. For some reason, these classes set their own HTTP headers,
   so I also expect these three to be created there.
 * Just to be sure, I checked the WP-Matomo source code – and as expected, no one
   of these headers is set by WP-Matomo.
 *  Thread Starter [GermanKiwi](https://wordpress.org/support/users/germankiwi/)
 * (@germankiwi)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/empty-http-headers-added-when-using-php-api-mode/#post-10240892)
 * Just to clarify – are you saying that these headers are set by some external 
   Matomo classes and **not** by your plugin?
 * Does that mean they’re out of your control? Is there anything I (or you) can 
   do to change this behaviour with the headers?
 * I’d like to be able to use the PHP mode, but I can’t when it’s generating conflicting
   headers like this. 🙂
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/empty-http-headers-added-when-using-php-api-mode/#post-10253166)
 * Well, if(!) it’s caused by Matomo, these are no external Matomo classes, these
   are internal Matomo classes. 😉 The plugin does not set these headers, so you
   should have a look at Matomos source code or check your other plugins.
 * If you identify where (and why) they are set as empty headers, you can take care
   of this. But first, you should ask the Matomo team if they know about the headers
   and if they can explain what’s happing there.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Empty HTTP headers added when using PHP API mode’ is closed to new replies.

 * ![](https://ps.w.org/wp-piwik/assets/icon-256x256.png?rev=3529668)
 * [Connect Matomo - Analytics Dashboard for WordPress](https://wordpress.org/plugins/wp-piwik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-piwik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-piwik/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-piwik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-piwik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-piwik/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [braekling](https://wordpress.org/support/users/braekling/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/empty-http-headers-added-when-using-php-api-mode/#post-10253166)
 * Status: not resolved