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

HTTPS gives all IP's 0.0.0.0 #8721

Closed
Firesphere opened this issue Sep 6, 2015 · 14 comments
Closed

HTTPS gives all IP's 0.0.0.0 #8721

Firesphere opened this issue Sep 6, 2015 · 14 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@Firesphere
Copy link

All my non-SSL connections work fine, but https gives 0.0.0.0 as origin IP. Doesn't matter what I try. I've been through the FAQ a dozen times, but no result :(

@tsteur
Copy link
Member

tsteur commented Sep 7, 2015

Can you have a look at #8030 (comment) and send us the output? That'd be really helpful

@Firesphere
Copy link
Author

Output:

array (
  'TMP' => '/srv/users/serverpilot/tmp/piwik',
  'TEMP' => '/srv/users/serverpilot/tmp/piwik',
  'TMPDIR' => '/srv/users/serverpilot/tmp/piwik',
  'PATH' => '/sbin:/usr/sbin:/bin:/usr/bin',
  'USER' => 'serverpilot',
  'HOME' => '/srv/users/serverpilot',
  'FCGI_ROLE' => 'RESPONDER',
  'SCRIPT_URL' => '/test.php',
  'SCRIPT_URI' => 'http://piwik.silverstripe-europe.org/test.php',
  'HTTP_HOST' => 'piwik.silverstripe-europe.org',
  'HTTP_X_FORWARDED_FOR' => '82.197.211.195, 82.197.211.195',
  'HTTP_CONNECTION' => 'close',
  'HTTP_ACCEPT_ENCODING' => 'gzip',
  'HTTP_CF_IPCOUNTRY' => 'NL',
  'HTTP_CF_RAY' => '2223d60a24112bca-AMS',
  'HTTP_X_FORWARDED_PROTO' => 'https',
  'HTTP_CF_VISITOR' => '{"scheme":"https"}',
  'HTTP_X_COOKIESOK' => 'I explicitly accept all cookies',
  'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0',
  'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.5',
  'HTTP_COOKIE' => '__cfduid=dfcf747e2e045261c34aef06187440a861441396002',
  'HTTP_DNT' => '1',
  'HTTP_CF_CONNECTING_IP' => '82.197.211.195',
  'HTTP_CF_UNBUFFERED_UPLOAD' => '0',
  'LD_LIBRARY_PATH' => '/opt/sp/apache/lib',
  'SERVER_SIGNATURE' => '',
  'SERVER_SOFTWARE' => 'Apache/2.4.16 (Unix) OpenSSL/1.0.1f',
  'SERVER_NAME' => 'piwik.silverstripe-europe.org',
  'SERVER_ADDR' => '127.0.0.1',
  'SERVER_PORT' => '80',
  'REMOTE_ADDR' => '82.197.211.195',
  'DOCUMENT_ROOT' => '/srv/users/serverpilot/apps/piwik/public',
  'REQUEST_SCHEME' => 'http',
  'CONTEXT_PREFIX' => '',
  'CONTEXT_DOCUMENT_ROOT' => '/srv/users/serverpilot/apps/piwik/public',
  'SERVER_ADMIN' => 'webmaster@',
  'SCRIPT_FILENAME' => '/srv/users/serverpilot/apps/piwik/public/test.php',
  'REMOTE_PORT' => '39841',
  'GATEWAY_INTERFACE' => 'CGI/1.1',
  'SERVER_PROTOCOL' => 'HTTP/1.0',
  'REQUEST_METHOD' => 'GET',
  'QUERY_STRING' => '',
  'REQUEST_URI' => '/test.php',
  'SCRIPT_NAME' => '/test.php',
  'PHP_SELF' => '/test.php',
  'REQUEST_TIME_FLOAT' => 1441643823.7082689,
  'REQUEST_TIME' => 1441643823,
  'argv' => 
  array (
  ),
  'argc' => 0,
)

config.ini.php proxy_client_headers:

[General]
;assume_secure_protocol = 1
proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
proxy_client_headers[] = "HTTP_CF_CONNECTING_IP"
proxy_client_headers[] = "HTTP_CLIENT_IP"
proxy_client_headers[] = "REMOTE_ADDR";

@tsteur
Copy link
Member

tsteur commented Sep 10, 2015

@Firesphere I just wanted to have a look but I'm wondering where exactly you get origin IP 0.0.0.0? I need to know in order to reproduce. Is it during tracking?

@tsteur
Copy link
Member

tsteur commented Sep 10, 2015

Do you have anything configured for proxy_ips?

@mattab
Copy link
Member

mattab commented Sep 20, 2015

@Firesphere do you maybe have answers to our couple questions above?

@Firesphere
Copy link
Author

@mattab Sorry! I've been a bit busy (I'm in the process of moving from the Netherlands to New Zealand, takes up a lot of time and thoughts)

The IP is (according to my breakpoint) in the IP class itself actually, where there's the default 0.0.0.0, and the headers are then looped.
At the breakpoint before the foreach, the IP seems to be set and recognized, but in the loop itself, it's empty.

I do not have anything specifically configured for proxy_ips, as far as I know. I've only altered/tested/tried with the proxy_client_headers

@tsteur
Copy link
Member

tsteur commented Sep 21, 2015

OK we should try to reproduce, only had a look at the code so far and that looked good. @mattab do you mind setting a milestone? Not sure what to set

@mattab mattab added this to the 2.15.1 milestone Sep 21, 2015
@mattab
Copy link
Member

mattab commented Sep 21, 2015

done: 2.15.1

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Sep 21, 2015
@mattab
Copy link
Member

mattab commented Oct 5, 2015

Note: our FAQ about this topic is https://piwik.org/faq/troubleshooting/faq_17710/

@tsteur
Copy link
Member

tsteur commented Oct 27, 2015

@Firesphere do you mind adding this line https://github.com/piwik/piwik/pull/9099/files#diff-a1ef1fb37277203311f5eed60b826653R119 to core/IP.php and see if it changes something for you?

@Firesphere
Copy link
Author

Sorry for the late reply, but it seems this solves the no-ip issue indeed. I've been testing a bit, but have not yet encountered any 0.0.0.0 errors anymore. (Or any other replacement IP for that matter)

@mattab
Copy link
Member

mattab commented Nov 2, 2015

Nice to hear & good find @tsteur 👍

Let's also add a test for this use case

@tsteur
Copy link
Member

tsteur commented Nov 2, 2015

There's a test in the PR

@mattab
Copy link
Member

mattab commented Nov 2, 2015

Nice! this issue will be fixed in 2.15.1

@mattab mattab closed this as completed Nov 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants