Page 2 of 7

Re: Cloudflare IP support

Posted: Wed Feb 04, 2015 10:04 pm
by Lumpy Burgertushie
I do believe that is because their instructions are for 3.0 not 3.1

robert

Re: Cloudflare IP support

Posted: Wed Feb 04, 2015 10:07 pm
by BigDrago
Lumpy Burgertushie wrote:I do believe that is because their instructions are for 3.0 not 3.1

robert
That was what I said :)

Re: Cloudflare IP support

Posted: Thu Feb 05, 2015 8:27 am
by fulgan
BigDrago wrote:
Lumpy Burgertushie wrote:I do believe that is because their instructions are for 3.0 not 3.1

robert
That was what I said :)
Then you're in the wrong forum, pal : this is for 3.1.x :)

Re: Cloudflare IP support

Posted: Thu Feb 05, 2015 3:06 pm
by fulgan
Ok. I got 5 minutes to look into this again and here is a quick and dirty fix:

In phpbb\session.php around line 280, you'll see this line:

Code: Select all

$this->ip = htmlspecialchars_decode($request->server('REMOTE_ADDR'));
replace it with

Code: Select all

		if ($request->server('HTTP_CF_CONNECTING_IP') != '') 
		{
			$this->ip = htmlspecialchars_decode($request->server('HTTP_CF_CONNECTING_IP'));
		}
		else
		{
			$this->ip = htmlspecialchars_decode($request->server('REMOTE_ADDR'));
		};
BTW, in PHP 5.5+, you can't use

Code: Select all

!empty($request->server('HTTP_CF_CONNECTING_IP'))

Re: Cloudflare IP support

Posted: Thu Feb 05, 2015 8:59 pm
by BigDrago
Nice work! Thank you very much! Seems to be working. Using PHP Version 5.4.36

Re: Cloudflare IP support

Posted: Fri Feb 06, 2015 10:03 am
by BigDrago
Hmmm... doesn't seem to work...
Getting "The submitted form was invalid. Try submitting again." when posting as guest.

Have to disable this:
ACP - security settings - disabled "Tie forms to guest sessions".

Re: Cloudflare IP support

Posted: Fri Feb 06, 2015 11:01 am
by fulgan
Well, I don't allow guest posting so I really can't tell (why do that, anyway ? You're really in that much need for Russian counterfeit "enhancement" pills ?). Sounds like a minor issue, though.

Re: Cloudflare IP support

Posted: Fri Feb 06, 2015 11:16 am
by BigDrago
fulgan wrote:Well, I don't allow guest posting so I really can't tell (why do that, anyway ? You're really in that much need for Russian counterfeit "enhancement" pills ?). Sounds like a minor issue, though.
Well. It is not just only posting. But guests can't register.

Re: Cloudflare IP support

Posted: Tue Feb 10, 2015 8:23 pm
by fulgan
BigDrago wrote:
fulgan wrote:Well, I don't allow guest posting so I really can't tell (why do that, anyway ? You're really in that much need for Russian counterfeit "enhancement" pills ?). Sounds like a minor issue, though.
Well. It is not just only posting. But guests can't register.

Ah, that's more annoying, I admit. I'll look into it tomorrow

Re: Cloudflare IP support

Posted: Sat Feb 14, 2015 2:17 pm
by BigDrago
Got an reply from Cloudflare support. They couldnĀ“t help us :/

Re: Cloudflare IP support

Posted: Wed Apr 01, 2015 8:26 am
by SugarD-x
Did anyone ever come up with a cleaner fix?

Re: Cloudflare IP support

Posted: Wed Apr 01, 2015 8:38 am
by fulgan
SugarD-x wrote:Did anyone ever come up with a cleaner fix?
Nope, but on the other hand, I tested guest user registration and, at least on my board, it worked just fine no matter what settings I used for the "Tie forms to guest sessions" parameter.

It's hard to know what to fix when it just seems to work. I'd have loved for PHPBB to properly support reverse proxy but not enough to cook up the necessary code myself and submit it.

Re: Cloudflare IP support

Posted: Wed Apr 01, 2015 8:57 am
by SugarD-x
I may give it a try then. I noticed you mentioned issues with PHP 5.5+. Is the fix in that post above the mentioned issue still working in PHP 5.5+, or is it affected too?

Re: Cloudflare IP support

Posted: Wed Apr 01, 2015 9:07 am
by fulgan
I have only tested my fix on PHP 5.4.36-0 (which is what is provided by my hoster).

That being said, the only comment I see related to PHP 5.5 is the one where I comment on another suggested fix (which does not work). The code I provided should be compatible with both 5.4 and 5.5

Re: Cloudflare IP support

Posted: Wed Apr 01, 2015 10:24 am
by SugarD-x
Awesome, thank you! I'll give it a try and see what happens. :)