• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

CloudFlare + Chevereto 2.X (outdated)

Rodolfo

⭐ Chevereto Godlike
Chevereto Staff
Administrator
cloudflare-logo.png

Note: This guide is for Chevereto 2.X, if you are running Chevereto 3.X you only need to go to your Dashboard > Settings > External services and enable CloudFlare.

This guide will help you to proper setup CloudFlare on your Chevereto website. CloudFlare is a reverse proxy that will make your website more secure and more faster. It will also help you to save bandwidth and server resources. Please notice that in order to use this service you must sign up to CloudFlare (free). Once you have your account just login and follow this steps.

1. Add your website to CloudFlare
  • Go to My Websites and enter your domain name and then click on "Add website".
  • CloudFlare will scan your records, just wait like 60 seconds.
  • Once it finish the scan it will show you all your subdomains and MX records. All the records with this icon
    icon-cloud-on.png
    will use CloudFlare. So if you don't want that some sub-domain use the service just click that icon and the sub-domain will bypass the CloudFlare service (
    icon-cloud-bypass.png
    )
  • Click continue, then use this settings (recommended). Keep in mind that you can change it later.
  • Then, you will need to change your DNS to point CloudFlare. Just to to your domain register and change the DNS to NS1: roxy.ns.cloudflare.com NS2: todd.ns.cloudflare.com and delete any extra DNS record.
2. Configure your website
In this step we will disallow caching on the files that we don't need to cache. This is the important part of the guide because if you don't do this you will see cached version of the dynamic files.
  • Go to My Websites and click on this icon
    icon-gear-medallion-hover.png
    on the right side of your domain, then click "Page rules".
  • In page rules enter this 3 rules:
  1. URL Pattern: /*.php
    • Forwarding: OFF
    • Custom caching: Bypass Cache
    • Always Online, Performance and Security set ON
  2. URL Pattern: /admin*
    • Forwarding: OFF
    • Custom caching: Bypass Cache
    • Always Online, Performance and Security set ON
  3. URL Pattern: /.htaccess
    • This is actually just in case you edit a lot the .htaccess
    • Forwarding: OFF
    • Custom caching: Bypass Cache
    • Always Online, Performance and Security set ON
3. Enable CloudFlare real IP on Chevereto
CloudFlare will mask the user real IP. To get the real user IP go to includes/config.php and replace this:
PHP:
//$_SERVER['REMOTE_ADDR'] = (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];
With this:
PHP:
$_SERVER['REMOTE_ADDR'] = (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];
4. You are READY!

That's all, you don't need anything else. Now you can:
Hope it helps, I know that there may be some other (better?) CDN / Reverse proxy alternatives but this one has been pretty useful on the demo taking into account the huge amount of China Malware and spam bots from that country.
 
Last edited:
I was wonderdering if it's possible to use cloudflare only for the website and not for the cache of the images.

As i know cloudflare doesn't allow big images hosting site because he put on cache ALL the images and consume a lot of bandwith. For example cloudflare cache me every day 500 Gb of bandwith.

So now i was thinking if it's possible exclude cloudflare from the cache of the images.

I created a page rule with the bypass of cache on example.com/images/* can it work?
 
It worked fine and that what happened.

sm1n.png


I consumed like 200 Gb of Bandwith in some hours and my VPS crashed cause of "Cannot allocate memory: fork: Unable to fork new process".

I re-actived cloudflare and banned China users for now.
 
Honestly, there is no point in allowing those China visitors. Is the same issue that happens in the demo, they use it to upload porn pictures that where used in several sites ans scrappers (hundreds of them) and the bandwidth just go insane. My solution was simple, I don't block China but I ban the uploader of those pictures (and everytime I notice it I ban him again) because is just one guy who is using the site and the scrappers are actually the problem.
 
Honestly, there is no point in allowing those China visitors. Is the same issue that happens in the demo, they use it to upload porn pictures that where used in several sites ans scrappers (hundreds of them) and the bandwidth just go insane. My solution was simple, I don't block China but I ban the uploader of those pictures (and everytime I notice it I ban him again) because is just one guy who is using the site and the scrappers are actually the problem.

You are right but i don't quote you. For me have a service of images hosting is host ALL images that users want to host. If i can't handle hight volume of images, my site is useless. I'm waiting the version 3.0 to use multiserver, for now i'm only testing the servers and i'm taking praticity with Linux/server/updats etc.

However i was thinking to the OVH hosting, because give the "unlimited" bandwith and it's real (not fake like 99% of hosting). Obvius only in case cloudflare ban me, now i consume 800 Gb every day. and cloudflare cache the 99% of bandwith.

I don't want ban China because, we know that they are bots, but they views are real => real users. (every day i have 1.000 unique visitors from China)
 
You are doing it wrong, you and everyone needs an anti abuse policy. No one has inifite resources to allow this kind of abuse.
 
An advice for people that use Cloudflare. If you have a big site that has a lot of hits and cloudflare is using a lot of Bandwitdh i advice to bypass the cache for images with extension .png/.jpeg/.bmp. Leaving only the .jpg on cache.

With this "trick" you can save some bandwitdh on Cloudflare without the risck of Ban cause of abusing their BW.

Remember that .jpg images are the 80%~ of total images, so you are removing only a little %.

With this method i can continue to use Cloudflare with 20.000.000 hits every day without go agaist the TOS of Cloudflare.

Good luck
 
Anyone tried the "Rocket Loader" function on Cloudflare for Chevereto?

Rocket Loader is a general-purpose asynchronous JavaScript loader coupled with a lightweight virtual browser which can safely run any JavaScript code after window.onload. In other words, it turns a page which takes 12 seconds to load into a page which takes 2 seconds to load.
 
It should have the same settings but you don't need to edit the Chevereto code this time. Simply go to your dashboard > Settings > External and enable Cloudflare.
 
made 2 tests - test-machine have got a huge 1024 kb bandwith line :D - it' is a standart ADSL Line with 16.000 kb down and 1024 kb upload..

first try - without caching JS - caching JPG and bypass PHP- served 213,38 MiB
second try - with caching JS / JPG and bypass PHP- served 1,11 GiB

here are the results:


 
Does the Cloudflare real IP still apply to Chevereto 3.3.2 and above? Thanks!
For Chevereto 3 you need to go to your Dashboard > Settings > External services and enable CloudFlare.
 
Back
Top