Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Sent from" URL in email reports contains IP address instead of host name #11545

Closed
LLPP65 opened this issue Mar 28, 2017 · 19 comments
Closed

"Sent from" URL in email reports contains IP address instead of host name #11545

LLPP65 opened this issue Mar 28, 2017 · 19 comments
Labels
worksforme The issue cannot be reproduced and things work as intended.
Milestone

Comments

@LLPP65
Copy link

LLPP65 commented Mar 28, 2017

My email reports have an IP address for the host portion of the "Sent from" section at the top of the weekly email report. This causes all the logo and flag images in the report to be blank because the site that serves them is one of many virtual servers on the same IP address.

Sent from http://a.b.c.d/.

I am running the latest version of Piwik, 3.0.2.

@LLPP65
Copy link
Author

LLPP65 commented Mar 28, 2017

Additional data point... The report contains an IP address instead of a host name when the report is sent as a scheduled job. If I manually trigger a report to be sent from the administration interface, then the report is correct and contains a proper host name as part of the "Sent from" URL.

@LLPP65
Copy link
Author

LLPP65 commented Mar 28, 2017

Another data point. The "Sent from" uses the correct hostname un the URL for one server's reports and an IP address in the URL for another. Very confusing.

@LLPP65
Copy link
Author

LLPP65 commented May 2, 2017

This behaviour is still the same in 3.0.4

@dbapl
Copy link

dbapl commented May 7, 2017

Same thing in update notifications:

Hello,

Some plugins you use have been updated on the Marketplace:

 * AOM 0.6.3

Click here to update your plugins now:
https://a.b.c.d/index.php?module=CorePluginsAdmin&action=plugins

Happy analysing!

@mattab mattab added this to the Priority Backlog (Help wanted) milestone May 8, 2017
@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label May 8, 2017
@mattab
Copy link
Member

mattab commented Sep 19, 2017

Maybe we should check that the Piwik URL is found in the trusted_hosts and if not, default to use the trusted_hosts instead?

we'll also need to make sure it works when Piwik is installed in a sub-directory.

@tsteur
Copy link
Member

tsteur commented Sep 19, 2018

Was this maybe fixed in #13122 ?

@mattab
Copy link
Member

mattab commented Oct 5, 2018

Please reopen if you still experience the issue with the latest Matomo @LLPP65

@mattab mattab closed this as completed Oct 5, 2018
@mattab mattab added the worksforme The issue cannot be reproduced and things work as intended. label Oct 5, 2018
@LLPP65
Copy link
Author

LLPP65 commented Oct 9, 2018

My latest email reports still contain IP addresses instead of hostnames.

@tsteur
Copy link
Member

tsteur commented Oct 9, 2018

Just to double check: That'S with 3.6.1? Would it be possible that we debug this issue on your system?

@LLPP65
Copy link
Author

LLPP65 commented Oct 9, 2018 via email

@mattab mattab reopened this Oct 9, 2018
@mattab
Copy link
Member

mattab commented Oct 9, 2018

Would it be possible to send us SSH Access to the matomo server? You can email at matomo.org/contact
Thank you!

@LLPP65
Copy link
Author

LLPP65 commented Oct 9, 2018 via email

@tsteur
Copy link
Member

tsteur commented Oct 9, 2018

Sorry meant 3.6.0, 3.6.1 isn't out yet :)

Two things: I'm just seeing the fix will only apply if you delete your current stored Matomo URL. Any chance you can execute this SQL query and check if the error persists?

delete from piwik_option where option_name = 'piwikUrl';

Your table prefix may differ from piwik_.

If it then still uses the wrong URL, and in case you are familiar with PHP/Server could you maybe just for one request apply this file change send us the output of this (make sure to remove the added lines after testing):

diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php
index bfd4ab4aeb..616a98cd01 100644
--- a/core/SettingsPiwik.php
+++ b/core/SettingsPiwik.php
@@ -177,6 +177,12 @@ class SettingsPiwik
      */
     public static function getPiwikUrl()
     {
+        $currentUrl = Common::sanitizeInputValue(Url::getCurrentUrlWithoutFileName());
+        $test = Url::getHostFromUrl($currentUrl);
+        var_export('host: ' . $test);
+        var_export($_SERVER);
+        exit;
+
         $url = Option::get(self::OPTION_PIWIK_URL);
 
         $isPiwikCoreDispatching = defined('PIWIK_ENABLE_DISPATCH') && PIWIK_ENABLE_DISPATCH;
@@ -189,8 +195,6 @@ class SettingsPiwik
             return $url;
         }
 
-        $currentUrl = Common::sanitizeInputValue(Url::getCurrentUrlWithoutFileName());
-
         // when script is called from /misc/cron/archive.php, Piwik URL is /index.php
         $currentUrl = str_replace("/misc/cron", "", $currentUrl);

@tsteur
Copy link
Member

tsteur commented Oct 9, 2018

Feel free to anonymize sensitive information from $_SERVER

@LLPP65
Copy link
Author

LLPP65 commented Oct 15, 2018 via email

@tsteur
Copy link
Member

tsteur commented Oct 15, 2018

I can't really explain how it would work through the web interface but not when the task is executed. As CLI should not use a different URL so it seems the tasks must be triggered through some HTTP request when executing a tracking request or so.

I reckon it will be good to also not modify the piwik url in tracker mode here: https://github.com/matomo-org/matomo/blob/3.6.1-rc1/core/SettingsPiwik.php#L183-L190 As tracking requests might be sent to a different servers for example. But this could maybe mess up with some scheduled tasks if for some reason the piwik URL wouldn't be set.

@LLPP65 could you go to "Administration => General Settings" and check if browser archiving is enabled or disabled? Also do you know if archiving is maybe triggered through a cronjob or maybe to a request to misc/user/archive.php?

@tsteur
Copy link
Member

tsteur commented Nov 6, 2018

Any update here @LLPP65 ?

@tsteur tsteur added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Nov 6, 2018
@tsteur tsteur removed the worksforme The issue cannot be reproduced and things work as intended. label Nov 6, 2018
@LLPP65
Copy link
Author

LLPP65 commented Dec 17, 2018 via email

@tsteur tsteur added worksforme The issue cannot be reproduced and things work as intended. and removed Bug For errors / faults / flaws / inconsistencies etc. Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. labels Dec 17, 2018
@tsteur
Copy link
Member

tsteur commented Dec 17, 2018

Awesome. That's great to hear 👍I'll close the issue for now.

@tsteur tsteur closed this as completed Dec 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

4 participants