Hacker News new | past | comments | ask | show | jobs | submit login

A brief reminder: Whenever you publish code or documentation that might be used/scraped by the outside world, ALWAYS use a domain you own. If you're on Cloudflare you can instantly (and for free) create Page Rules to use Cloudflare as a CDN, redirect to another CDN, or black-hole or reroute traffic anywhere you want.



When working on APIs meant to be used client-side (especially mobile clients) by different customers are partners, use one subdomain per integrator. If there's a bug in their integration, it could easily DDoS your servers, but DNS is an easy way to have a manual kill switch.


Literally had this happen to us (website, not API) from a misconfigured partner last week - they accidentally misrouted unrelated click traffic through our servers. A 2 minute Page Rule and we not only saved our servers, we protected our partner's brand until they could hotfix. We could have done this with a rule looking at the path, but not easily something looking at obscure auth keys. Segmented traffic is happy traffic.


Not to mention that if Cloudflare CDN was in front of it this traffic would be free.


Not with this amount of traffic it won't be free. 45 TB per day lol Cloudflare will be disabling your account and in contact for payment in a hurry.

Go ahead and try, see how far their "free" tier really goes.


For comparison, that's just about half the amount cdnjs delivers every day (on average) https://github.com/cdnjs/cf-stats/blob/master/2019/cdnjs_Aug...


Just waiting for the Cloudflare CEO who lurks around to pop in here and offer it for free.


Not sure about that. Especially if it all goes to one ip address where they have peering arrangements. It could cause some load there but the traffic will be essentially free for cloudflare. And some good publicity for Cloudflare.


I'm skeptical of the number of 500+ MB files the CloudFlare CDN would actually cache...

Does anyone have any numbers on this?


Correct; Cloudflare doesn't cache large asset files (I think anything more than 2MB?) by default. It's not that kind of CDN... at least, not for free it's not.

Of course, you can trick Cloudflare into caching your large media assets using some funky Page Rules... but I wouldn't suggest it. Mostly just for moral reasons. If you have that much traffic, you should be making some money off it and then paying Cloudflare with it!


512mb: https://support.cloudflare.com/hc/en-us/articles/200172516-U...

And a "cache everything" page rule tends to cache literally any file type, but it's not a great idea to push media files through CF due to the TOS prohibiting "disproportionate amounts of non-web content".

2mb might be referencing the limit for Workers KV.


Ah, much better than 2MB. An image for a high resolution display can hit that easily. Less so 512MB.


Good point. I guess for free plans they only cache up to 512mb files [1]. It does seem you can set page rules to cache large files by extension [2].

1. https://support.cloudflare.com/hc/en-us/articles/200172516 2. https://support.cloudflare.com/hc/en-us/articles/11500015027...



huh? why publish if you don’t want it used?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: