Cloudflare IP support

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Ideas Centre
User avatar
Lumpy Burgertushie
Registered User
Posts: 66342
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Cloudflare IP support

Post by Lumpy Burgertushie » Wed Feb 04, 2015 10:04 pm

I do believe that is because their instructions are for 3.0 not 3.1

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

BigDrago
Registered User
Posts: 319
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cloudflare IP support

Post by BigDrago » Wed Feb 04, 2015 10:07 pm

Lumpy Burgertushie wrote:I do believe that is because their instructions are for 3.0 not 3.1

robert
That was what I said :)

fulgan
Registered User
Posts: 73
Joined: Wed Jun 02, 2004 12:46 pm

Re: Cloudflare IP support

Post by fulgan » Thu Feb 05, 2015 8:27 am

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 :)

fulgan
Registered User
Posts: 73
Joined: Wed Jun 02, 2004 12:46 pm

Re: Cloudflare IP support

Post by fulgan » Thu Feb 05, 2015 3:06 pm

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'))

BigDrago
Registered User
Posts: 319
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cloudflare IP support

Post by BigDrago » Thu Feb 05, 2015 8:59 pm

Nice work! Thank you very much! Seems to be working. Using PHP Version 5.4.36

BigDrago
Registered User
Posts: 319
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cloudflare IP support

Post by BigDrago » Fri Feb 06, 2015 10:03 am

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".

fulgan
Registered User
Posts: 73
Joined: Wed Jun 02, 2004 12:46 pm

Re: Cloudflare IP support

Post by fulgan » Fri Feb 06, 2015 11:01 am

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.

BigDrago
Registered User
Posts: 319
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cloudflare IP support

Post by BigDrago » Fri Feb 06, 2015 11:16 am

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.

fulgan
Registered User
Posts: 73
Joined: Wed Jun 02, 2004 12:46 pm

Re: Cloudflare IP support

Post by fulgan » Tue Feb 10, 2015 8:23 pm

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

BigDrago
Registered User
Posts: 319
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cloudflare IP support

Post by BigDrago » Sat Feb 14, 2015 2:17 pm

Got an reply from Cloudflare support. They couldn´t help us :/

SugarD-x
Registered User
Posts: 45
Joined: Mon Jun 19, 2006 12:42 am
Location: Sacramento, California USA
Contact:

Re: Cloudflare IP support

Post by SugarD-x » Wed Apr 01, 2015 8:26 am

Did anyone ever come up with a cleaner fix?

fulgan
Registered User
Posts: 73
Joined: Wed Jun 02, 2004 12:46 pm

Re: Cloudflare IP support

Post by fulgan » Wed Apr 01, 2015 8:38 am

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.

SugarD-x
Registered User
Posts: 45
Joined: Mon Jun 19, 2006 12:42 am
Location: Sacramento, California USA
Contact:

Re: Cloudflare IP support

Post by SugarD-x » Wed Apr 01, 2015 8:57 am

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?

fulgan
Registered User
Posts: 73
Joined: Wed Jun 02, 2004 12:46 pm

Re: Cloudflare IP support

Post by fulgan » Wed Apr 01, 2015 9:07 am

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

SugarD-x
Registered User
Posts: 45
Joined: Mon Jun 19, 2006 12:42 am
Location: Sacramento, California USA
Contact:

Re: Cloudflare IP support

Post by SugarD-x » Wed Apr 01, 2015 10:24 am

Awesome, thank you! I'll give it a try and see what happens. :)

Post Reply

Return to “Extension Requests”