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

Wrong Location for Opera Mini users #10816

Closed
evrard-c opened this issue Nov 1, 2016 · 10 comments
Closed

Wrong Location for Opera Mini users #10816

evrard-c opened this issue Nov 1, 2016 · 10 comments
Labels
answered For when a question was asked and we referred to forum or answered it. Bug For errors / faults / flaws / inconsistencies etc.

Comments

@evrard-c
Copy link

evrard-c commented Nov 1, 2016

When a user access to the site by using Opera Mini, Piwik displays a wrong location, this location always be "Norway" or "EU". This wrong location occur because Opera Mini is a proxy browser, so the location indicated by Piwik it's the location of Opera Mini's server not the user location.
Piwik use the IP adress of Opera Mini server instead of the true IP adress of the user.
This can be fixed by using the real IP of the user like Opera explanes it in this page when talking about "X-Forwarded-For"

It might be better to also have the real Opera Mini icon instead of the same as Opera because they don't have the same icon, each has its own.

Yes, i know that it looks like an Opera Mini's advocacy, but when you work on a project in a country where Opera Mini reach 85% of the traffic, you don't really have choice. ;)

@sgiehl
Copy link
Member

sgiehl commented Nov 2, 2016

It might be better to also have the real Opera Mini icon instead of the same as Opera because they don't have the same icon, each has its own.

If Opera Next is detected it should use the icon https://github.com/piwik/piwik/blob/3.x-dev/plugins/DevicesDetection/images/browsers/ON.gif Isn't that correct?

@evrard-c
Copy link
Author

evrard-c commented Nov 3, 2016

Ooh, not really
That's the icon for "Opera Next", but I was talking about "Opera Mini"

@sgiehl
Copy link
Member

sgiehl commented Nov 3, 2016

Ok. Opera and Opera Mini use icons that are almost identical. This one ise used for Opera Mini and may need an update: https://github.com/piwik/piwik/blob/3.x-dev/plugins/DevicesDetection/images/browsers/OI.gif

@evrard-c
Copy link
Author

evrard-c commented Nov 4, 2016

Yeah it will need an update and it will also be better if the right IP of the visitor using Opera Mini is used to identify his right location instead of always indicate the Opera Mini's server location. This dysfunction creat big statistics errors for countries where Opera Mini is largely used.

@mattab
Copy link
Member

mattab commented Nov 11, 2016

@evrard-c Maybe Opera Mini still forward the original user IP in another HTTP header? we have similar cases already see: http://piwik.org/faq/how-to-install/faq_98/

if you have access to a opera mini please visit a page test.php with <?php var_dump($_SERVER); ?> and post here the output you see in opera mini?

@mattab mattab added this to the 3.0.0 milestone Nov 11, 2016
@evrard-c
Copy link
Author

evrard-c commented Nov 13, 2016

@mattab as you asked, I created a test page with <?php var_dump($_SERVER); ?> and bellow it's the output of the test page as displayed in Opera Mini.

To identify the location of the visitor, Piwik uses the IP in ["REMOTE_ADDR"] unfortunatelly, this is the IP of the Opera Mini's server. In the Dev documentation Opera recommand to use the IP in ["HTTP_X_FORWARDED_FOR"] to get the IP of the visitor, So this one can give the true location of the visitor instead of giving the location of the Opera Mini's server.

array(45) { ["PATH"]=> string(29) "/sbin:/usr/sbin:/bin:/usr/bin" ["PWD"]=> string(25) "/usr/local/cpanel/cgi-sys" ["SHLVL"]=> string(1) "0" ["PHP_FCGI_MAX_REQUESTS"]=> string(4) "5000" ["SCRIPT_NAME"]=> string(11) "/test-2.php" ["REQUEST_URI"]=> string(11) "/test-2.php" ["QUERY_STRING"]=> string(0) "" ["REQUEST_METHOD"]=> string(3) "GET" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["REMOTE_PORT"]=> string(5) "49823" ["SCRIPT_FILENAME"]=> string(35) "/home/mysite1/public_html/test-2.php" ["SERVER_ADMIN"]=> string(18) "webmaster@mysite.cd" ["CONTEXT_DOCUMENT_ROOT"]=> string(24) "/home/site1/public_html" ["CONTEXT_PREFIX"]=> string(0) "" ["REQUEST_SCHEME"]=> string(5) "https" ["DOCUMENT_ROOT"]=> string(24) "/home/mysite1/public_html" ["REMOTE_ADDR"]=> string(14) "82.145.219.168" ["SERVER_PORT"]=> string(3) "443" ["SERVER_ADDR"]=> string(13) "23.229.143.84" ["SERVER_NAME"]=> string(12) "www.mysite.cd" ["SERVER_SOFTWARE"]=> string(13) "Apache/2.4.23" ["SERVER_SIGNATURE"]=> string(0) "" ["LD_LIBRARY_PATH"]=> string(21) "/usr/local/apache/lib" ["HTTP_X_FORWARDED_FOR"]=> string(14) "169.255.204.14" ["HTTP_X_OPERAMINI_PHONE"]=> string(9) "Android #" ["HTTP_FORWARDED"]=> string(26) "for="169.255.204.14:11842"" ["HTTP_X_OPERAMINI_PHONE_UA"]=> string(145) "Mozilla/5.0 (Linux; Android 4.4.4; SM-J100H Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36" ["HTTP_X_OPERAMINI_FEATURES"]=> string(94) "advanced, httpping, pingback, routing, viewport, folding, camera, download, touch, file_system" ["HTTP_DEVICE_STOCK_UA"]=> string(145) "Mozilla/5.0 (Linux; Android 4.4.4; SM-J100H Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36" ["HTTP_CONNECTION"]=> string(5) "close" ["HTTP_CACHE_CONTROL"]=> string(8) "no-cache" ["HTTP_COOKIE"]=> string(98) "_pk_id.1.761e=9ea9373d14368c08.1477603572.2.1478986736.1478986736.; _ga=GA1.2.966386884.1476233539" ["HTTP_ACCEPT_ENCODING"]=> string(13) "gzip, deflate" ["HTTP_ACCEPT_LANGUAGE"]=> string(11) "fr,en;q=0.9" ["HTTP_ACCEPT"]=> string(129) "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1" ["HTTP_HOST"]=> string(12) "www.mysite.cd" ["HTTP_USER_AGENT"]=> string(87) "Opera/9.80 (Android; Opera Mini/12.0.1987/37.9072; U; fr) Presto/2.12.423 Version/12.16" ["SSL_TLS_SNI"]=> string(12) "www.mysite.cd" ["HTTPS"]=> string(2) "on" ["UNIQUE_ID"]=> string(24) "WChzKTI@oWMAADctokcAAABA" ["FCGI_ROLE"]=> string(9) "RESPONDER" ["PHP_SELF"]=> string(11) "/test-2.php" ["REQUEST_TIME_FLOAT"]=> float(1479045929.6347) ["REQUEST_TIME"]=> int(1479045929) }

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Dec 5, 2016
@mattab
Copy link
Member

mattab commented Dec 5, 2016

Thanks @evrard-c for the details.

In the Dev documentation Opera recommand to use the IP in ["HTTP_X_FORWARDED_FOR"] to get the IP of the visitor, So this one can give the true location of the visitor instead of giving the location of the Opera Mini's server.

Do you maybe have a link to this doc?

Note: currently you can configure Piwik to read the HTTP_X_FORWARDED_FOR IP instead of REMOTE_ADDR, as documented in: http://piwik.org/faq/how-to-install/faq_98/ - but this will apply to all visits... so this does not work too well when only opera mini users will set this header.

Once confirmed then, it sounds like we will need to add a "Special case" handling for Opera mini users, and always read HTTP_X_FORWARDED_FOR for these users.

@evrard-c
Copy link
Author

@mattab ,
I'm glad that you understand the problem
This is the link to the doc where Opera explains details about HTTP Headers in Opera Mini : https://dev.opera.com/articles/opera-mini-request-headers/
I also think that the best way to correct it, will be to add a "Special case" handling for Opera Mini users

@robocoder
Copy link
Contributor

Or add 195.189.142.0/23 to proxy_ips?

@evrard-c
Copy link
Author

This solved the problem for Opera Mini

currently you can configure Piwik to read the HTTP_X_FORWARDED_FOR IP instead of REMOTE_ADDR, as documented in: http://piwik.org/faq/how-to-install/faq_98/

@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it. Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

4 participants