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





 
 
 
 


308 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
64667 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.

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

3496 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 »

Microsoft New Zealand Partner Awards results
Posted 18-Oct-2019 10:18


Logitech introduces new Made for Google keyboard and mouse devices
Posted 16-Oct-2019 13:36


MATTR launches to accelerate decentralised identity
Posted 16-Oct-2019 10:28


Vodafone X-Squad powers up for customers
Posted 16-Oct-2019 08:15


D Link ANZ launches EXO Smart Mesh Wi Fi Routers with McAfee protection
Posted 15-Oct-2019 11:31


Major Japanese retailer partners with smart New Zealand technology IMAGR
Posted 14-Oct-2019 10:29


Ola pioneers one-time passcode feature to fight rideshare fraud
Posted 14-Oct-2019 10:24


Spark Sport new home of NZC matches from 2020
Posted 10-Oct-2019 09:59


Meet Nola, Noel Leeming's new digital employee
Posted 4-Oct-2019 08:07


Registrations for Sprout Accelerator open for 2020 season
Posted 4-Oct-2019 08:02


Teletrac Navman welcomes AI tech leader Jens Meggers as new President
Posted 4-Oct-2019 07:41


Vodafone makes voice of 4G (VoLTE) official
Posted 4-Oct-2019 07:36


2degrees Reaches Milestone of 100,000 Broadband Customers
Posted 1-Oct-2019 09:17


Nokia 1 Plus available in New Zealand from 2nd October
Posted 30-Sep-2019 17:46


Ola integrates Apple Pay as payment method in New Zealand
Posted 25-Sep-2019 09:51



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.