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.




32 posts

Geek
+1 received by user: 2


Topic # 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
Fully Operational
3304 posts

Uber Geek
+1 received by user: 1072

Trusted
Vocus
Subscriber

  Reply # 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
58319 posts

Uber Geek
+1 received by user: 9765

Administrator
Trusted
Geekzone
Subscriber

  Reply # 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.





 
 
 
 


207 posts

Master Geek
+1 received by user: 58


  Reply # 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
58319 posts

Uber Geek
+1 received by user: 9765

Administrator
Trusted
Geekzone
Subscriber

  Reply # 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.







32 posts

Geek
+1 received by user: 2


  Reply # 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?

Fully Operational
3304 posts

Uber Geek
+1 received by user: 1072

Trusted
Vocus
Subscriber

  Reply # 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.

3351 posts

Uber Geek
+1 received by user: 373

Trusted

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

That seems pretty expensive for your international traffic?!







32 posts

Geek
+1 received by user: 2


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

3351 posts

Uber Geek
+1 received by user: 373

Trusted

  Reply # 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.







32 posts

Geek
+1 received by user: 2


  Reply # 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?

1916 posts

Uber Geek
+1 received by user: 110


  Reply # 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 »

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 »

Nothing nebulous about Microsoft’s cloud-transition
Posted 21-Jul-2017 15:34


We’re spending more on tech, but not as much as Australians
Posted 21-Jul-2017 11:43


Endace announces EndaceFabric for network-wide packet recording
Posted 20-Jul-2017 20:49


Acorn 6: MacOS image editing for the rest of us
Posted 20-Jul-2017 17:04


HTC faces backlash over keyboard pop-up ads
Posted 19-Jul-2017 15:53


BNZ adds Visa credit cards to Android Pay wallet
Posted 18-Jul-2017 19:44


Still living in a Notification hell – Om Malik
Posted 18-Jul-2017 13:00


Duet Display uses iPad to extend Mac, PC
Posted 18-Jul-2017 10:58


PC sales could be worse
Posted 17-Jul-2017 07:34


Crypto-currencies, tulips, market bubbles
Posted 17-Jul-2017 06:38


NZ Tech Podcast: Big batteries, solar cars, cold war, IoT
Posted 16-Jul-2017 16:53


Vodafone Australia mulls Wisp alliance, NZ implications
Posted 13-Jul-2017 16:49


Rural health professionals see fibre pay-off
Posted 13-Jul-2017 11:52


Vodafone announces expansion of $5 Daily Roaming
Posted 13-Jul-2017 10:20


Intel unveils powerful Intel Xeon Scalable processors
Posted 12-Jul-2017 20:41



Geekzone Live »

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



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.