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)
Get Involved
BigDrago
Registered User
Posts: 360
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cloudflare IP support

Post by BigDrago »

How can I check if mod_cloudflare is enabled?

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

Re: Cloudflare IP support

Post by fulgan »

Log into the administrator control panel and check your last successful ACP (near the bottom of the "general" landing page). If it lists your real WAN IP, then mod_cloudflare is working.

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

Re: Cloudflare IP support

Post by BigDrago »

fulgan wrote: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'))
This one worked.
But my host told me they had mod_cloudflare so I removed these lines...seems like my host is lying..
Guess I have to edit this code again then.

Swanny
Registered User
Posts: 452
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: Cloudflare IP support

Post by Swanny »

fulgan wrote:Actually, the rocket loader and the caching parameter stuff depends a lot on the theme and CSS you use. I'm using (mostly) PBWoW and these were necessary because of all the javascript that collection of themes uses.
You seem very knowledgeable on this topic, thanks for your help. It would be nice if us folks using CF could band together and put together a master "how-to" guide with info and tips on how to make phpBB work with CF for everyone. I know a lot of issues are due to webmasters not knowing the intricacies such as what you need to do if you use mod_cloudflare versus if you don't, etc. The doc could include the tip about logging into ACP and checking for WAN IP, etc. I am willing to provide what I've learned along the way too.

I was searching more on Rocket Loader and AdSense and most of the posts regarding the compatibility problems seem to be from 2012-2013. I am going to enable RL and see if it will work OK for me. Even CF's own documentation says it may or may not cause problems with AdSense.

fulgan, you didn't say, are you running AdSense on your phpBB board?

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

Re: Cloudflare IP support

Post by BigDrago »

fulgan wrote:Log into the administrator control panel and check your last successful ACP (near the bottom of the "general" landing page). If it lists your real WAN IP, then mod_cloudflare is working.
I am getting the server ip as my own when I log in.

I got this as an confirmation that mod_cloudflare is enabled on the server from my host:


This is a confirmation that mod_cloudflare is already enabled on your server

###
CloudFlareRemoteIPHeader (mod_cloudflare.c)
CloudFlareRemoteIPTrustedProxy (mod_cloudflare.c)
DenyAllButCloudFlare (mod_cloudflare.c)
###
-rw-r--r-- 1 root root 837 May 31 00:30 /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/ModCloudflare.pm
###

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: Cloudflare IP support

Post by Volksdevil »

Swanny wrote:
Volksdevil wrote:I have absolutely no issues using cloudflare, with pretty much everything enabled inc rocketloader. There was an issue at one time, but cloudflare made changes.

I could never have got results like this without cloudflare >> http://gtmetrix.com/reports/www.corradog60.com/ffzwZpAF :shock: :D
Wow those are some great scores, almost unheard of for phpBB installations.

As far as I can tell, you're fine to run Rocketloader as long as you don't have AdSense on the page. Since you don't, you're OK. I have AdSense on my forum so I have to have Rocketloader off. I just wanted to clarify that point as it was mentioned by the other fella to turn RL off.
I do actually run Adsense :) on all of my cloudflare powered sites with no issues, all using rocketloader too.
PS:Obviously regards those scores I've made some additional changes to speed things up, removed a lot of what I deem unnecessary code/images etc.
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

Swanny
Registered User
Posts: 452
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: Cloudflare IP support

Post by Swanny »

Volksdevil wrote:I do actually run Adsense :) on all of my cloudflare powered sites with no issues, all using rocketloader too.
Whoops, had my ad blocker turned on.

I enabled Rocket Loader, I will keep an eye on my AdSense #s to see if anything weird happens there. I also turned on HTML Auto Minify.

Swanny
Registered User
Posts: 452
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: Cloudflare IP support

Post by Swanny »

Volksdevil, fulgan, what do you have your CF "Browser Cache Expiration" set to? It defaults to 4 hours, I changed it to 8 days.

On dynamic pages it should probably be like 1 minute, for static images & css it should probably be a week. Just looking for phpBB specific advice on what you guys are doing.

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: Cloudflare IP support

Post by Volksdevil »

Yep 8 days here too and no issues at all Swanny 8-)
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

bossxxl
Registered User
Posts: 19
Joined: Sat Apr 25, 2015 3:09 am

Re: Cloudflare IP support

Post by bossxxl »

this stuff is easy to fix you just need to add in the server you host on it
plugin you setup it then you server will work with real ips
link for the fix guys ^^


Apache 2.4 + mod_CloudFlare.c

Make sure the following is installed:
Red Hat/Fedora:

sudo yum install httpd24-devel libtool git

Debian/Ubuntu:

sudo apt-get install apache2-dev libtool git

Clone the following for the most recent build of mod_cloudflare:
Red Hat/Fedora/Debain/Ubuntu:

git clone https://github.com/cloudflare/mod_cloudflare.git && cd mod_cloudflare

Use the Apache extension tool to convert the .c file into a module:
Red Hat/Fedora/Debain/Ubuntu:

apxs -a -i -c mod_cloudflare.c

Restart & verify the module is active:
Red Hat/Fedora:

service httpd restart && httpd -M|grep cloudflare

Debian/Ubuntu:

sudo apachectl restart; apache2ctl -M|grep cloudflare

Swanny
Registered User
Posts: 452
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: Cloudflare IP support

Post by Swanny »

FYI enabling Rocket Loader on my static site and my forum site did not cause a problem with anything. AdSense is showing and accruing earnings, and the sites are fast.

So far there are no downsides to using CloudFlare with phpBB, even with their free offering.

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: Cloudflare IP support

Post by Volksdevil »

Guys, is the HTML minification causing problems for anybody in PM composing?

Specifically, if you view YOURSITE.COM/styles/prosilver/template/ucp_header.html what shows up there as the source?

Is the <!-- INCLUDE overall_header.html --> tag missing?
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

Swanny
Registered User
Posts: 452
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: Cloudflare IP support

Post by Swanny »

I have HTML minification turned on but when I view the page source it does not look minified... hmmm??
Edit: On second thought it is removing some comments, nevermind.
Last edited by Swanny on Sat Jun 13, 2015 5:03 pm, edited 2 times in total.

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: Cloudflare IP support

Post by Volksdevil »

Probably need to purge 'everything' in the cloudflare CP :) For some reason it can take quite some time to start looking minified, I've had this happen several times.

Is the <!-- INCLUDE overall_header.html --> tag missing?
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

Swanny
Registered User
Posts: 452
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: Cloudflare IP support

Post by Swanny »

I checked the code on your Corrado site and mine, the code is identical. <!-- INCLUDE overall_header.html --> is missing from both.

Compare the source code:
yours @ [removed by request]
to @ styles/prosilver/template/ucp_header.html (non minified)

I went to the compose PM screen and it all looks fine on my site. I didn't actually try to send a PM though.
Last edited by KevC on Wed Jun 17, 2015 1:46 pm, edited 2 times in total.
Reason: link removed by request

Post Reply

Return to “Extension Requests”