Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




41 posts

Geek


# 143341 11-Apr-2014 10:55
Send private message

Is anyone using Cloudflare to limit their International traffic for a site?
We are, and while it has greatly reduced the amount of unwanted traffic from bots in (the usual suspects), we belatedly realised that it is serving New Zealand requests from Sydney. Since we are on a typical VPS with unlimited, free domestic traffic but 25GB/month International  then $5/GB, this is Not a Good Thing™

We have turned on Cloudflare's location header, now we need a way to use that data to ensure that NZ requests are redirected to bypass Cloudflare. I'm thinking of an alias pointing straight to our server (like their direct. alias) but not sure how to proceed from there.
The site is Drupal 7 + CiviCRM on CentOS/Plesk

Richard

Create new topic
3344 posts

Uber Geek

Trusted
Vocus

  # 1023325 11-Apr-2014 11:04
Send private message

As far as I know there's no way to do this with CloudFlare.  There might be other DNS services which can serve location-specific IPs for requests, but that would probably break Cloudflare given the way it operates.

BDFL - Memuneh
65372 posts

Uber Geek

Administrator
Trusted
Geekzone
Lifetime subscriber

  # 1023334 11-Apr-2014 11:25
Send private message

Correct. You can use some DNS providers to reply with specific IP addresses depending on location but that will break Cloudflare because it uses its own DNS.





 
 
 
 


317 posts

Ultimate Geek


  # 1023337 11-Apr-2014 11:27
Send private message

We evaluated Cloudfare but the fact that the nearest POP was in Sydney and there was no way of service the content locally from NZ users put us off, as we already use AWS Cloudfront. You may want to take a look at fastly.com instead.

BDFL - Memuneh
65372 posts

Uber Geek

Administrator
Trusted
Geekzone
Lifetime subscriber

  # 1023339 11-Apr-2014 11:31
Send private message

The OP uses Cloudflare as a way to reduce traffic impact on costs. Fastly has NZ presence but charges per request and volume, which will not meet the OP's needs.







41 posts

Geek


  # 1023388 11-Apr-2014 12:16
One person supports this post
Send private message

(second attempt at replying after my browser most thoughtfully crashed)

 

Cloudflare had confirmed that they can't deal with it at their end, but it should be fixable at our end with some server-fu.

 

As I see it:
1) NZ-based user requests www.example.co.nz - DNS is with Cloudflare.
2) If request is for a static page they have cached, they serve it, all well and good. If not cacheable, they send request to our server, complete with CF_IPCountry header.
3) Server reads that header and if it has value "NZ" responds with a 301 to nz.example.co.nz which is set up as an alias here and has a DNS record for our server's IP.

I'm guessing that step 3 should happen in .htaccess, which is where drupal does all its URL rewriting
How would I structure it to avoid loops?
Should I use 301, 302, 307 or 308 as redirection code?

Should I also put code in settings.php to change the URLs used by Drupal in links?

3344 posts

Uber Geek

Trusted
Vocus

  # 1023426 11-Apr-2014 13:30
Send private message

I'm not 100% on the implementation details but I'd say you're on the right track with that idea.  Nice thinking.

3525 posts

Uber Geek

Trusted

  # 1023427 11-Apr-2014 13:31
Send private message

That seems pretty expensive for your international traffic?!




Speedtest 2019-10-14


 
 
 
 




41 posts

Geek


  # 1023428 11-Apr-2014 13:37
Send private message

Net24, and I thought it was fairly typical. Although their VPS pricing is much cheaper than many NZ companies I've seen, so it might be a balance between base price and built-in.
I don't think I could face another server move at present :-)

3525 posts

Uber Geek

Trusted

  # 1023435 11-Apr-2014 13:48
Send private message

maybe you could negotiate with them? Seriously $5 per GB even for enterprise bandwidth is way too high. Should be maybe $0.50 max.




Speedtest 2019-10-14




41 posts

Geek


  # 1027714 19-Apr-2014 14:20
Send private message

Okay, an update on this.

 

 

 

It failed on our test site but then I realised that that is because the test site DNS bypasses Cloudflare so doesn't get the header.

 

I confirmed that the live site does receive the header, but my rewrite, which is

 

# Redirect traffic originating from NZ to NZ subdomain
RewriteCond %{HTTP:CF_IPCountry} ^NZ$ [NC]
RewriteRule ^(.*)$ http://nz.permaculture.org.nz/$1 [L,R=301]

is not having effect. Not sure whether this is because of the way Plesk handles aliases or because other parts of the Drupal .htaccess are interfering?

1917 posts

Uber Geek


  # 1027738 19-Apr-2014 15:24

It wont work if your server is behind CF you need to implement page rules.

Create new topic



Twitter and LinkedIn »



Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Vodafone New Zealand starts two year partnership with LetsPlay.Live
Posted 28-Jan-2020 11:24


Ring launches indoor-only security camera
Posted 23-Jan-2020 17:26


New report findings will help schools implement the digital technologies curriculum content
Posted 23-Jan-2020 17:25


N4L to upgrade & support wireless internet inside schools
Posted 23-Jan-2020 17:22


Netflix releases 21 Studio Ghibli works
Posted 22-Jan-2020 11:42


Vodafone integrates eSIM into device and wearable roadmap
Posted 17-Jan-2020 09:45


Do you need this camera app? Group investigates privacy implications
Posted 16-Jan-2020 03:30


JBL launches headphones range designed for gaming
Posted 13-Jan-2020 09:59


Withings introduces ScanWatch wearable combining ECG and sleep apnea detection
Posted 9-Jan-2020 18:34


NZ Police releases public app
Posted 8-Jan-2020 11:43


Suunto 7 combine sports and smart features on new smartwatch generation
Posted 7-Jan-2020 16:06


Intel brings innovation with technology spanning the cloud, network, edge and PC
Posted 7-Jan-2020 15:54


AMD announces high performance desktop and ultrathin laptop processors
Posted 7-Jan-2020 15:42


AMD unveils four new desktop and mobile GPUs including AMD Radeon RX 5600
Posted 7-Jan-2020 15:32


Consolidation in video streaming market with Spark selling Lightbox to Sky
Posted 19-Dec-2019 09:09



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.