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
+1 received by user: 5


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
3343 posts

Uber Geek
+1 received by user: 1088

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
60051 posts

Uber Geek
+1 received by user: 11138

Administrator
Trusted
Geekzone
Lifetime 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.





 
 
 
 


Try Wrike: fast, easy, and efficient project collaboration software
248 posts

Master Geek
+1 received by user: 78


  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
60051 posts

Uber Geek
+1 received by user: 11138

Administrator
Trusted
Geekzone
Lifetime 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.







41 posts

Geek
+1 received by user: 5


  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
3343 posts

Uber Geek
+1 received by user: 1088

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.

3392 posts

Uber Geek
+1 received by user: 395

Trusted

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

That seems pretty expensive for your international traffic?!







41 posts

Geek
+1 received by user: 5


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

3392 posts

Uber Geek
+1 received by user: 395

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.







41 posts

Geek
+1 received by user: 5


  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?

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

Opera launches new mobile browser: Opera Touch
Posted 25-Apr-2018 20:45


TCF and Telcos Toughen Up on Scam Callers
Posted 23-Apr-2018 09:39


Amazon launches the International Shopping Experience in the Amazon Shopping App
Posted 19-Apr-2018 08:38


Spark New Zealand and TVNZ to bring coverage of Rugby World Cup 2019
Posted 16-Apr-2018 06:55


How Google can seize Microsoft Office crown
Posted 14-Apr-2018 11:08


How back office transformation drives IRD efficiency
Posted 12-Apr-2018 21:15


iPod laws in a smartphone world: will we ever get copyright right?
Posted 12-Apr-2018 21:13


Lightbox service using big data and analytics to learn more about customers
Posted 9-Apr-2018 12:11


111 mobile caller location extended to iOS
Posted 6-Apr-2018 13:50


Huawei announces the HUAWEI P20 series
Posted 29-Mar-2018 11:41


Symantec Internet Security Threat Report shows increased endpoint technology risks
Posted 26-Mar-2018 18:29


Spark switches on long-range IoT network across New Zealand
Posted 26-Mar-2018 18:22


Stuff Pix enters streaming video market
Posted 21-Mar-2018 09:18


Windows no longer Microsoft’s main focus
Posted 13-Mar-2018 07:47


Why phone makers are obsessed with cameras
Posted 11-Mar-2018 12:25



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.