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.


dramatic

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

Affiliate link
 
 
 

Affiliate link: Backblaze Unlimited Backup. World’s easiest cloud backup. Get peace of mind knowing your files are backed up securely in the cloud.
freitasm
BDFL - Memuneh
74139 posts

Uber Geek

Administrator
ID Verified
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.





Support Geekzone by subscribing, making a donation. or using one of our referral links: Sharesies | Goodsync  | Mighty Ape | Backblaze | Norton 360 | Lenovo laptops 

 

freitasm on Keybase | My technology disclosure

 

 

 

 

 

 


marpada
385 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.



freitasm
BDFL - Memuneh
74139 posts

Uber Geek

Administrator
ID Verified
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.





Support Geekzone by subscribing, making a donation. or using one of our referral links: Sharesies | Goodsync  | Mighty Ape | Backblaze | Norton 360 | Lenovo laptops 

 

freitasm on Keybase | My technology disclosure

 

 

 

 

 

 


dramatic

41 posts

Geek


  #1023388 11-Apr-2014 12:16
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?

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

Zeon
3861 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




dramatic

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

Zeon
3861 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


dramatic

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?

SteveON
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





News and reviews »

Amazon to Acquire iRobot
Posted 6-Aug-2022 11:41


Samsung x LIFE Picture Collection Brings Iconic Moments in History to The Frame
Posted 4-Aug-2022 17:04


Norton Consumer Cyber Safety Pulse Report: Phishing for New Bait on Social Media
Posted 4-Aug-2022 16:50


Microsoft Announces New Solutions for Threat Intelligence and Attack Surface Management
Posted 3-Aug-2022 21:54


Seagate Addresses Hyperscale Workloads with Enterprise-Class Nytro SSDs
Posted 3-Aug-2022 21:50


Visa Launching Eco-friendly Payment Solutions in New Zealand
Posted 3-Aug-2022 21:48


NCR Delivers Services to Run Bank of New Zealand ATM Network
Posted 30-Jul-2022 11:06


New HP Portfolio Supports New Era of Hybrid Work
Posted 28-Jul-2022 17:14


Harman Kardon Launches Citation MultiBeam 1100 Soundbar
Posted 28-Jul-2022 17:10


Nanogirl Labs Launches Creator Project
Posted 28-Jul-2022 17:05


Marvel Snap Launches as an Action Collectible Card Game
Posted 26-Jul-2022 17:46


Jabra Talk 65 Review
Posted 26-Jul-2022 17:31


Huawei Watch D Review
Posted 26-Jul-2022 17:26


Huawei Introduces Watch Fit 2
Posted 14-Jul-2022 17:06


Huawei Launches Watch D in New Zealand
Posted 14-Jul-2022 17:05









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.







Backblaze unlimited backup