cloudflare教程怎么越过去

CloudFlare与WebLuker
之前用过国内的免费CDN:WebLuker, 最近又试用了老美的CloudFlare,所以很自然地就将两者做了一次简单对比(本人不是砖家,有失偏颇之处请忍住),有需求的童鞋们可以对比参照,选择适合自己的服务商。
先说说两者的节点范围:CloudFlare在分别在美国加州的圣何塞、伊利诺伊州的芝加哥、佛吉尼亚的阿什本、日本的东京、荷兰的阿姆斯特丹,布有节点,基本上北美、东亚、西欧都做了分布,国内用户访问,基本都走的日本节点;WebLuker的节点分布在国内,电信和联通都有,海外访问基本都走的东部沿海的电信节点。
再说说上手过程:CloudFlare的操作过程跟Windows的程序安装类似,一路&Next Step&即可,该过程中CloudFlare自动读取你的当前DNS设置,且在你的确认之后,保存并提示你更改域名DNS为CloudFlare提供于你的两个,然后就是等待新DNS生效即可(很多童鞋不喜欢更改DNS,这对站点的SEO等指标不利),在设置期间,你即使不看帮助文档,也能轻松自如的做好一切工作;另外,你可以方便地开启或关闭你的域名、子域名的服务状态:是使用CloudFlare的CDN服务,还是直接使用源站服务。而WebLuker就多少有点麻烦了:添加加速频道、等待审核、完善服务信息,我当时如若不是跟客服不间断地沟通,恐怕一周之内都无法完全理解WebLuker的工作流程。这些步骤中,尤其是等待审核这一步,需要你的域名备案信息,并且要人工审核你的站点内容,多少让人觉得不舒服、慢,不过鉴于国内的形势,这么做也无可厚非!不过,WebLuker不需要你更改DNS,只要做好相关域名的CNAME设置和服务信息即可。
第三,看看两者的衍生、周边服务:WebLuker在你使用其服务的同时,还提供了智能DNS(可分运营商、大区的解析模式)、HTTP/HTTPS/SNMP/PING/端口监测、站点监测的一站式监测服务,相当方便。CloudFlare则没有提供类似的监控功能,但却有另外的两项重量级服务可用:一个是Analytics统计分析,另个是阻止攻击(Threat control)。Analytics服务不用赘述,这就是一个简版的Google Analytics;&阻止攻击服务&则比较实用,它会列出针对你的站点有危害行为的IP,并将其详细信息(Whois、运营商、物理位置、危害类型等)以报告的形式表现出来,你可以针对某一个或多个IP进行&拒绝&和&信任&的设定,另外,你还可以自己输入某个/某段/某国的IP,来进行有针对性的&拒绝访问&。除此之外,可暂停CDN的&开发者模式&、针对已缓存文件的&一键清除&、图片的防盗链功能、缓存级别、安全级别等等一系列细致周到且实用的功能,更增加了CloudFlare的吸引力!
第四,两者CDN服务带来的实际效果:CloudFlare离我们最近的毕竟只有一个东京节点,再快,Ping值也在150ms以上;而WebLuker则拥有众多的电信、联通节点,但针对国外访客,效果不甚理想;所以两者针对国内、外不同访客的服务质量上的优劣,一眼即知。
最后一个,就是服务在国内的&可持续性&:针对CloudFlare的封锁已经开始,幸好其可用IP地址众多,如果你在使用中被分配了一个&失效&IP,那么别犹豫,马上和他们的客服联系,他们会在24小时内为你更换一个新IP。也是因为这个原因,在解决问题的同时,我还因此而结交了一位美国朋友,用E-Mail聊聊天也不错!相反,作为标准的国内企业,ChinaCache旗下的WebLuker的风险则要小得多,况且在使用他们的服务之前,一系列审核步骤都已就绪。
所以,通过以上这些介绍、对比,选谁不选谁,童鞋们心里可有底儿了?
文章来源:&转载请注明出处链接。
最新图文推荐
合作媒体专栏
本业跟互联网无关,只是兴趣爱好,所以水平不高、研究不深,写的东西也是毛毛躁躁,各...
大家感兴趣的内容
&&<a rel="nofollow" class="red" href="" target="_blank" color="red新版网站排行榜
===全新上线===
网友热评的文章
seajs.config({
base: "/resource/passapi/scripts/"
seajs.use('seajs/seajs-css');
seajs.use(['artdialog/src/dialog-plus'], function (dialog) {
$('#favorite').on('click', function(){
$.getJSON('/passapi.php?op=userstatus&callback=?', function(data){
if (data.status == 1) {
var _this = $('#favorite').find('span');
$.getJSON('/?app=favorite&controller=favorite&action=add&jsoncallback=?&contentid='+contentid, function(json){
if(json.state){
_this.html('CloudFlare Client API | CloudFlare | The web performance & security company
CloudFlare is removing support for this API on November 9th, 2016. Please
use CloudFlare’s API v4 instead. Documentation is available at
Last updated: May 14, 2015
CloudFlare has published new client APIs at . New methods will be added to those APIs. We encourage the use of the new APIs, rather than these v1 methods. However, the v1 APIs detailed here will be supported indefinitely, with significant advance notice to any users of these methods.
Note: members of multi-user organizations within CloudFlare are not able to use the v1 APIs documented here, only those methods at .
This document explains in detail the semantics of the function calls you can make using the Client Interface API, version 1 (v1).
In this document, you will learn:
Retrieve basic statistics for your website
Retrieve/Modify common CloudFlare settings
Toggle Development Mode on/off
Purge the CloudFlare cache and the Preloader Cache
This document is subject to change. The latest version of this document is always maintained at:
If you have comments, find errors, or have questions, please contact
Interaction with the CloudFlare system is accomplished
with POST requests through the secure HTTP protocol (HTTPS). This
protocol was chosen for its simplicity, network administrators'
familiarity with it, its ability to pass through many corporate
firewalls without requiring their modification, the
protocol's extensive documentation, and the wide availability of access tools
written in many languages.
Some links concerning establishing and performing POST requests over secure HTTP sessions are provided below:
Windows () |
There are some general issues that you should keep in mind when
designing an application for interacting with this API. You may want to
refer to this checklist as you are constructing the application.
Neglecting to follow these general guidelines is the
usual source of difficulty for application designers.
All requests should be established via a secure SSL connection through the HTTPS protocol.
All operation requests are initiated via a GET/POST request from the client to the CloudFlare system.
The order in which you pass the parameters does not matter.
All responses are returned as .
The precise order of the fields in the JSON responses, as described
in the examples in this document, may change and should not be relied
Samples POSTS provided on this page use the common unix cURL utility. The -d options sets a POST parameter.
All calls are rate-limited to 1200 every 5 minutes, unless otherwise specified.
Ask for a JSONP callback by appending a &callback=mycallback parameter.
All GET/POST requests should be directed at the client gateway interface, located at:
/api_json.html
Every GET/POST request must include at the following basic parameter(s):
This is the API key made available on your
The e-mail address associated with the API key.
To define which request is being made, the client should POST an
"a" parameter. The "a" specifies which action you'd like to perform.
Specific actions are described in
If there are errors, the JSON response will include a detailed message in the "msg" field, and sometimes will include one of the following error codes:
"E_UNAUTH" -- Authentication could not be completed
"E_INVLDINPUT" -- Some other input was not valid
"E_MAXAPI" -- You have exceeded your allowed number of API calls.
Retrieve the current stats and settings for a particular website. This function can be used to get currently settings of values such as the security level.
Requires the basic parameters described in
of this document. In addition, you must pass the following parameters:
The zone (domain) that statistics are being retrieved from
"interval"
The time interval for the statistics denoted by these values:
For these values, the latest data is from one day ago
20 = Past 30 days
30 = Past 7 days
40 = Past day
The values are for Pro accounts
100 = 24 hours ago
110 = 12 hours ago
120 = 6 hours ago
Here is an example POST to the stats action for retrieving the past 7 days of statistics :
curl /api_json.html \
-d 'a=stats' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
-d 'interval=20'
"response": {
"result": {
"timeZero": 0,
"timeEnd": 0,
"count": 1,
"has_more": false,
"cachedServerTime": 0,
"cachedExpryTime": 0,
"trafficBreakdown": {
"pageviews": {
"regular": 2640,
"threat": 27,
"crawler": 4
"uniques": {
"regular": 223,
"threat": 16,
"crawler": 4
"bandwidthServed": {
"cloudflare": 688,
"user": 438
"requestsServed": {
"cloudflare": 4173,
"user": 3697
"pro_zone": false,
"pageLoadTime": null,
"currentServerTime": 0,
"interval": 20,
"zoneCDate": 0,
"userSecuritySetting": "Medium",
"dev_mode": 0,
"ipv46": 5,
"cache_lvl": "agg"
"result": "success",
"msg": null
This lists all domains in a CloudFlare account along with other data.
Requires the basic parameters described in
of this document.
Here is an example POST to the zone_load_multi action for retrieving the list of domains:
curl /api_json.html \
-d 'a=zone_load_multi' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"request": {
"act": "zone_load_multi",
"a": "zone_load_multi",
"email": "",
"tkn": "8afbe6deadd4c97bb6e25"
"response": {
"zones": {
"has_more": false,
"count": 3,
"zone_id": "42",
"user_id": "1",
"zone_name": "example-",
"display_name": "example-",
"zone_status": "V",
"zone_mode": "1",
"host_id": "415",
"zone_type": "P",
"host_pubname": "WebHost",
"host_website": "",
"vtxt": null,
"fqdns": null,
"step": "4",
"zone_status_class": "status-active",
"zone_status_desc": "CloudFlare powered, this website will be accelerated and protected ()",
"ns_vanity_map": [ ],
"orig_registrar": null,
"orig_dnshost": null,
"orig_ns_names": null,
"props": {
"dns_cname": 0,
"dns_partner": 1,
"dns_anon_partner": 0,
"expired_pro": 0,
"pro_sub": 0,
"expired_ssl": 0,
"expired_rs_pro": 0,
"reseller_pro": 0,
"force_interal": 0,
"ssl_needed": 0,
"alexa_rank": 0
"confirm_code": {
"zone_deactivate": "f91eb75acb516aa95dabf5fa2b7305ec",
"zone_dev_mode1": "84fae8edea45a39f"
"allow": [
"analytics",
"threat_control",
"cf_apps",
"dns_editor",
"cf_settings",
"page_rules",
"zone_deactivate",
"zone_dev_mode1"
"zone_id": "43",
"user_id": "1",
"zone_name": "example-domain-2.net",
"display_name": "example-domain-2.net",
"zone_status": "V",
"zone_mode": "0",
"host_id": null,
"zone_type": "F",
"host_pubname": null,
"host_website": null,
"vtxt": null,
"fqdns": [
"step": "4",
"zone_status_class": "status-deactivated",
"zone_status_desc": "Deactivated: Web traffic to this website will no longer pass through the CloudFlare system. We will continue to resolve your DNS. However, you will not receive the benefits of CloudFlare. You may
CloudFlare for this website at any time. ()",
"ns_vanity_map": [ ],
"orig_registrar": "A Registrar!",
"orig_dnshost": null,
"orig_ns_names": "{,}",
"props": {
"dns_cname": 0,
"dns_partner": 0,
"dns_anon_partner": 0,
"expired_pro": 0,
"pro_sub": 0,
"expired_ssl": 0,
"expired_rs_pro": 0,
"reseller_pro": 0,
"force_interal": 0,
"ssl_needed": 0,
"alexa_rank": 0
"confirm_code": {
"zone_delete": "79fece02a0b6db49ba25d"
"allow": [
"zone_reactivate",
"analytics",
"zone_delete",
"dns_editor",
"cf_settings",
"page_rules"
"zone_id": "44",
"user_id": "1",
"zone_name": "example-domain-3.org",
"display_name": "example-domain-3.org",
"zone_status": "V",
"zone_mode": "1",
"host_id": "115",
"zone_type": "P",
"host_pubname": "Some Host!",
"host_website": "WEBSITEOFHOST.org",
"vtxt": null,
"fqdns": null,
"step": "4",
"zone_status_class": "status-active",
"zone_status_desc": "CloudFlare powered, this website will be accelerated and protected ()",
"ns_vanity_map": [ ],
"orig_registrar": null,
"orig_dnshost": null,
"orig_ns_names": null,
"props": {
"dns_cname": 0,
"dns_partner": 1,
"dns_anon_partner": 0,
"expired_pro": 0,
"pro_sub": 0,
"expired_ssl": 0,
"expired_rs_pro": 0,
"reseller_pro": 0,
"force_interal": 0,
"ssl_needed": 0,
"alexa_rank": 0
"confirm_code": {
"zone_deactivate": "cbf79d69ad82aba1fa02ce",
"zone_dev_mode1": "fc6cacf3b4ef5bbdb9cae94"
"allow": [
"analytics",
"threat_control",
"cf_apps",
"dns_editor",
"cf_settings",
"page_rules",
"zone_deactivate",
"zone_dev_mode1"
"result": "success",
"msg": null
Lists all of the DNS records from a particular domain in a CloudFlare account
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The domain that records are being retrieved from
Optional. If the has_more parameter in the JSON response is true, you can use o=N to offset the starting position for the response. By default, this call will list the first 180 records for a zone.
Here is an example POST to the rec_load_all action for retrieving the DNS records :
curl /api_json.html \
-d 'a=rec_load_all' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"request": {
"act": "rec_load_all",
"a": "rec_load_all",
"email": "",
"tkn": "8afbe6deadd4c97bb6e25",
"response": {
"has_more": false,
"count": 7,
"rec_id": "",
"rec_tag": "7f8e77bac02ba65d34e20c4b994a202c",
"zone_name": "",
"name": "",
"display_name": "direct",
"type": "A",
"prio": null,
"content": "[server IP]",
"display_content": "[server IP]",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": null,
"ssl_status": null,
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "0",
"props": {
"proxiable": 1,
"cloud_on": 0,
"cf_open": 1,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0
"rec_id": "",
"rec_tag": "dffa176e5de",
"zone_name": "",
"name": "",
"display_name": "home",
"type": "A",
"prio": null,
"content": "[server IP]",
"display_content": "[server IP]",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": null,
"ssl_status": null,
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "0",
"props": {
"proxiable": 1,
"cloud_on": 0,
"cf_open": 1,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0
"rec_id": "",
"rec_tag": "23b26ce60b1",
"zone_name": "",
"name": "",
"display_name": "",
"type": "A",
"prio": null,
"content": "[server IP]",
"display_content": "[server IP]",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": null,
"ssl_status": null,
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "1",
"props": {
"proxiable": 1,
"cloud_on": 1,
"cf_open": 1,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0
"rec_id": "",
"rec_tag": "3bcef45cdf5b7638b13cfb89f1b6e716",
"zone_name": "",
"name": "",
"display_name": "test",
"type": "A",
"prio": null,
"content": "[server IP]",
"display_content": "[server IP]",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": null,
"ssl_status": null,
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "0",
"props": {
"proxiable": 1,
"cloud_on": 0,
"cf_open": 1,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0
"rec_id": "",
"rec_tag": "c0b453b2dd342114cbda86",
"zone_name": "",
"name": "",
"display_name": "www",
"type": "CNAME",
"prio": null,
"content": "",
"display_content": "",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": null,
"ssl_status": null,
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "0",
"props": {
"proxiable": 1,
"cloud_on": 0,
"cf_open": 1,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0
"rec_id": "",
"rec_tag": "1faa40f85c78bccb69eeb40",
"zone_name": "",
"name": "xn--",
"display_name": "?",
"type": "CNAME",
"prio": null,
"content": "",
"display_content": "",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": null,
"ssl_status": null,
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "1",
"props": {
"proxiable": 1,
"cloud_on": 1,
"cf_open": 1,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0
"rec_id": "",
"rec_tag": "e4dd98e6b6f7",
"zone_name": "",
"name": "",
"display_name": "yay",
"type": "CNAME",
"prio": null,
"content": "",
"display_content": "",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": null,
"ssl_status": null,
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "0",
"props": {
"proxiable": 1,
"cloud_on": 0,
"cf_open": 1,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0
"result": "success",
"msg": null
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
List of zones separated by comma
Here is an example POST to the zone_check checking for the zids for a list of different zones:
curl /api_json.html \
-d 'a=zone_check' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"response": {
"zones": {
"result": "success",
"msg": null
Find the current threat score for a given IP. Note that scores are on a logarithmic scale, where a higher score indicates a higher threat.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target IP
Here is an example POST to the ip_lkup for looking up the threat score for an example IP:
curl /api_json.html \
-d 'a=ip_lkup' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
-d 'ip=0.0.0.0'
"response": {
"[IP]": "BAD:0"
"result": "success",
"msg": null
Retrieves all current settings for a given domain.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
Here is an example POST to the zone_settings for looking up settings :
curl /api_json.html \
-d 'a=zone_settings' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"request": {
"act": "zone_settings",
"tkn": "8afbe6deadd4c97bb6e25",
"a": "zone_settings",
"email": ""
"response": {
"result": {
"userSecuritySetting": "Medium",
"dev_mode": ,
"ipv46": 3,
"cache_lvl": "agg",
"outboundLinks": "disabled",
"async": "0",
"bic": "1",
"chl_ttl": "900",
"exp_ttl": "7200",
"fpurge_ts": "",
"hotlink": "1",
"img": "171",
"lazy": "1",
"minify": "0",
"outlink": "0",
"preload": "0",
"s404": "1",
"sec_lvl": "med",
"spdy": "1",
"ssl": "1",
"waf_profile": "high"
"result": "success",
"msg": null
Explanation of some of the significant fields
"dev_mode" -- Development Mode status. A zero response indicates off. A non-zero response indicates on. The numerical value of a non-zero response indicates when Development Mode will expire.
"ob" -- Always O Values are [0 = 1 = on].
"ch_ttl" -- Challenge TTL, in seconds.
"exp_ttl" -- Expire TTL (for CloudFlare-cached items), in seconds.
"sec_lvl" -- Basic Security Level. Values are [eoff (Essentially Off), low, med, high, help (I'm Under Attack!)]
"cache_lvl" -- Caching Level. Values are: [agg = aggressive, iqs = simplified, basic]
"async" -- Rocket Loader. Values are: [0 = off, a = automatic, m = manual.]
"minify" -- Minification
1 = JavaScript only
2 = CSS only
3 = JavaScript and CSS
4 = HTML only
5 = JavaScript and HTML
6 = CSS and HTML
7 = CSS, JavaScript, and HTML
"ipv46" -- IPV6, Values are [0 = off, 3 = Full]
"bic" -- Browser Integrity Check. Values are [0 = off,
"email_filter" -- Email obfuscation. Values are [0 =
off, 1 = on]
"sse" -- Server Side Exclude. Values are [0 = off, 1 =
"hotlink" -- Hotlink Protection. Values are [0 = off, 1
"geoloc" -- IP Geolocation. Values are [0 = off, 1 =
"spdy" -- [PRO/BUSINESS/ENTERPRISE] SPDY. Values are [0
= off, 1 = on]
"ssl" -- [PRO/BUSINESS/ENTERPRISE] SSL Status. Values
are [0 = off, 1 = Flexible, 2 = Full, 3 = Full (Strict)]
"lazy" -- [PRO/BUSINESS/ENTERPRISE] Mirage: Lazy Load.
Values are [0 = off, 1 = on]
"img" -- [PRO/BUSINESS/ENTERPRISE] Mirage: Auto-resize,
Polish settings
1 = Auto-resize on
200 = Polish: Basic
201 = Polish: Basic, Mirage: Auto-resize on
170 = Polish: Basic + JPEG
171 = Polish: Basic + JPEG, Mirage: Auto-resize on
"preload" -- [PRO/BUSINESS/ENTERPRISE] Preloader. Values are [0 = off, 1 = on]
"waf_profile" -- [PRO/BUSINESS/ENTERPRISE] WAF setting. Values are [high, low, off]
This function sets the Basic Security Level to I'M UNDER ATTACK! / HIGH / MEDIUM / LOW / ESSENTIALLY OFF.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The domain that records are being retrieved from
The security level:
"help" -- I'm under attack!
"high" -- High
"med" -- Medium
"low" -- Low
"eoff" -- Essentially Off
Here is an example POST to the sec_lvl action for setting the security level to "I'm under attack!" :
curl /api_json.html \
-d 'a=sec_lvl' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
-d 'v=help'
"response": {
"zone_id": "44",
"user_id": "1",
"zone_name": "",
"display_name": "",
"zone_status": "V",
"zone_mode": "1",
"host_id": "115",
"zone_type": "P",
"host_pubname": "Hosting Provider",
"host_website": "",
"vtxt": null,
"fqdns": null,
"step": "4",
"zone_status_class": "status-active",
"zone_status_desc": "CloudFlare powered, this website will be accelerated and protected ()",
"ns_vanity_map": [ ],
"orig_registrar": null,
"orig_dnshost": null,
"orig_ns_names": null,
"props": {
"dns_cname": 0,
"dns_partner": 1,
"dns_anon_partner": 0,
"expired_pro": 0,
"pro_sub": 0,
"expired_ssl": 0,
"expired_rs_pro": 0,
"reseller_pro": 0,
"force_interal": 0,
"ssl_needed": 0,
"alexa_rank": 0
"confirm_code": {
"zone_deactivate": "cbf79d69ad82aba1fa02ce",
"zone_dev_mode1": "fc6cacf3b4ef5bbdb9cae94"
"allow": [
"analytics",
"threat_control",
"cf_apps",
"dns_editor",
"cf_settings",
"page_rules",
"zone_deactivate",
"zone_dev_mode1"
"result": "success",
"msg": null
This function sets the Caching Level to Aggressive or Basic.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
The cache level:
"agg" -- Aggressive
"basic" -- Basic
Here is an example POST to the cache_lvl action for setting the cache level to "Aggressive" :
curl /api_json.html \
-d 'a=cache_lvl' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
-d 'v=agg'
"response": {
"zone_id": "42",
"user_id": "1",
"zone_name": "",
"display_name": "",
"zone_status": "V",
"zone_mode": "1",
"host_id": "415",
"zone_type": "P",
"host_pubname": "SomeHost",
"host_website": "",
"vtxt": null,
"fqdns": null,
"step": "4",
"zone_status_class": "status-active",
"zone_status_desc": "CloudFlare powered, this website will be accelerated and protected ()",
"ns_vanity_map": [ ],
"orig_registrar": null,
"orig_dnshost": null,
"orig_ns_names": null,
"props": {
"dns_cname": 0,
"dns_partner": 1,
"dns_anon_partner": 0,
"expired_pro": 0,
"pro_sub": 0,
"expired_ssl": 0,
"expired_rs_pro": 0,
"reseller_pro": 0,
"force_interal": 0,
"ssl_needed": 0,
"alexa_rank": 0
"confirm_code": {
"zone_deactivate": "f91eb75acb516aa95dabf5fa2b7305ec",
"zone_dev_mode1": "84fae8edea45a39f"
"allow": [
"analytics",
"threat_control",
"cf_apps",
"dns_editor",
"cf_settings",
"page_rules",
"zone_deactivate",
"zone_dev_mode1"
"result": "success",
"msg": null
This function allows you to toggle Development Mode on or off for a particular domain. When Development Mode is on the cache is bypassed. Development mode remains on for 3 hours or until when it is toggled back off.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
1 for on, 0 for off
Here is an example POST to the devmode action for turning on Development Mode :
curl /api_json.html \
-d 'a=devmode' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
Development mode will expire on "expires_on" (3 hours from when it is toggled on). Development mode can be toggled off immediately by setting "v" to 0.
"response": {
"expires_on": ,
"zone_id": "42",
"user_id": "1",
"zone_name": "",
"display_name": "",
"zone_status": "V",
"zone_mode": "1",
"host_id": "415",
"zone_type": "P",
"host_pubname": "SomeHost",
"host_website": "",
"vtxt": null,
"fqdns": null,
"step": "4",
"zone_status_class": "status-dev-mode",
"zone_status_desc": "Development mode active: CloudFlare's accelerated cache is inactive on this site, so changes to cachable content (like images, CSS, or JavaScript) are visible immediately. Press shift-reload if your changes are not immediate. Development mode will automatically toggle off 3 hours after initial setup.",
"ns_vanity_map": [ ],
"orig_registrar": null,
"orig_dnshost": null,
"orig_ns_names": null,
"props": {
"dns_cname": 0,
"dns_partner": 1,
"dns_anon_partner": 0,
"expired_pro": 0,
"pro_sub": 0,
"expired_ssl": 0,
"expired_rs_pro": 0,
"reseller_pro": 0,
"force_interal": 0,
"ssl_needed": 0,
"alexa_rank": 0
"confirm_code": {
"zone_deactivate": "f91eb75acb516aa95dabf5fa2b7305ec"
"allow": [
"analytics",
"threat_control",
"cf_apps",
"dns_editor",
"cf_settings",
"page_rules",
"zone_deactivate",
"zone_dev_mode0"
"result": "success",
"msg": null
This function will purge CloudFlare of any cached files. It may take up to 48 hours for the cache to rebuild and optimum performance to be achieved so this function should be used sparingly.
Note: There is a limit for cache purges of 5 per minute. Exceeding this limit will return an error in the JSON response.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
Value can only be "1."c
Here is an example POST to the fpurge_ts action for purging the cache :
curl /api_json.html \
-d 'a=fpurge_ts' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"response": {
"fpurge_ts": ,
"zone_id": "438",
"user_id": "1",
"zone_name": "",
"display_name": "",
"zone_status": "V",
"zone_mode": "1",
"host_id": null,
"zone_type": "F",
"host_pubname": null,
"host_website": null,
"vtxt": null,
"fqdns": [
"step": "4",
"zone_status_class": "status-active",
"zone_status_desc": "CloudFlare powered, this website will be accelerated and protected ()",
"ns_vanity_map": [ ],
"orig_registrar": "ENOM, INC.",
"orig_dnshost": null,
"orig_ns_names": "{,}",
"props": {
"dns_cname": 0,
"dns_partner": 0,
"dns_anon_partner": 0,
"expired_pro": 0,
"pro_sub": 0,
"expired_ssl": 0,
"expired_rs_pro": 0,
"reseller_pro": 0,
"force_interal": 0,
"ssl_needed": 0,
"alexa_rank": 0
"confirm_code": {
"zone_deactivate": "f7d2ce4b08c1fea",
"zone_dev_mode1": "a69cbacfa8c0b50c2c418"
"allow": [
"analytics",
"threat_control",
"cf_apps",
"dns_editor",
"cf_settings",
"page_rules",
"zone_deactivate",
"zone_dev_mode1"
"result": "success",
"msg": null,
"attributes": {
"cooldown": 20
This function will purge a single file from CloudFlare's cache.
Note: There is a rate limit for file purges of 100 per minute. Exceeding this limit will return an error in the JSON response.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
The full URL of the file that needs to be purged from CloudFlare's cache. Keep in mind, that if an HTTP and an HTTPS version of the file exists, then both versions will need to be purged independently
Here is an example POST to the zone_file_purge action for purging the cache :
curl /api_json.html \
-d 'a=zone_file_purge' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
-d 'url=/style.css'
"request": {
"act": "zone_file_purge",
"tkn": "8afbe6deadd4c97bb6e25",
"email": "",
"a": "zone_file_purge",
"url": "/style.css"
"response": {
"vtxt_match": null,
"url": "/style.css"
"result": "success",
"msg": null
Whitelist with "wl" and Blacklist with "ban", and use "nul" to remove the IP from either of those lists
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The IP address you want to whitelist/blacklist
Here is an example POST to the wl action to whitelist an IP:
curl /api_json.html \
-d 'a=wl' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
-d 'key=0.0.0.0' \
"response": {
"result": {
"ip": "[IP]",
"action": "WL"
"result": "success",
"msg": null
"response": {
"result": {
"ip": "[IP]",
"action": "BAN"
"result": "success",
"msg": null
Toggles IPv6 support
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
Disable with 0, enable with 3
Here is an example POST to the ipv46 action to turn on IPv6 support :
curl /api_json.html \
-d 'a=ipv46' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"response": {
"zone_id": "763858",
"user_id": "39781",
"zone_name": "",
"display_name": "",
"zone_status": "V",
"zone_mode": "1",
"host_id": null,
"zone_type": "F",
"host_pubname": null,
"host_website": null,
"vtxt": null,
"fqdns": [
"step": "4",
"zone_status_class": "status-active",
"zone_status_desc": "CloudFlare powered, this website will be accelerated and protected ()",
"ns_vanity_map": [ ],
"orig_registrar": "ENOM, INC.",
"orig_dnshost": null,
"orig_ns_names": "{,}",
"props": {
"dns_cname": 0,
"dns_partner": 0,
"dns_anon_partner": 0,
"expired_pro": 0,
"pro_sub": 0,
"expired_ssl": 0,
"expired_rs_pro": 0,
"reseller_pro": 0,
"force_interal": 0,
"ssl_needed": 0,
"alexa_rank": 0
"confirm_code": {
"zone_deactivate": "f7d2ce4b08c1fea",
"zone_dev_mode1": "a69cbacfa8c0b50c2c418"
"allow": [
"analytics",
"threat_control",
"cf_apps",
"dns_editor",
"cf_settings",
"page_rules",
"zone_deactivate",
"zone_dev_mode1"
"result": "success",
"msg": null
Changes Rocket Loader setting
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
[0 = off, a = automatic, m = manual]
Here is an example POST to the async action to set Rocket Loader to "automatic" :
curl /api_json.html \
-d 'a=async' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"result": "success",
"msg": null
Changes minification settings
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
1 = JavaScript only
2 = CSS only
3 = JavaScript and CSS
4 = HTML only
5 = JavaScript and HTML
6 = CSS and HTML
7 = CSS, JavaScript, and HTML
Here is an example POST to the minify action to set minifcation for CSS and HTML :
curl /api_json.html \
-d 'a=minify' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"result": "success",
"msg": null
Toggles mirage2 support
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
Here is an example POST to the mirage2 action to turn on mirage2 support :
curl /api_json.html \
-d 'a=mirage2' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
"result": "success",
"msg": null
Create a DNS record for a zone
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
Type of DNS record. Values include: [A/CNAME/MX/TXT/SPF/AAAA/NS/SRV/LOC]
Name of the DNS record.
The content of the DNS record, will depend on the the type of record being added
TTL of record in seconds. 1 = Automatic, otherwise, value must in between 120 and 86400 seconds.
"prio"[applies to MX/SRV]
MX record priority.
"service"[applies to SRV]
Service for SRV record
"srvname"[applies to SRV]
Service Name for SRV record
"protocol"[applies to SRV]
Protocol for SRV record. Values include: [_tcp/_udp/_tls].
"weight"[applies to SRV]
Weight for SRV record.
"port"[applies to SRV]
Port for SRV record
"target"[applies to SRV]
Target for SRV record
Here is an example POST to the rec_new action to create an A record :
curl /api_json.html \
-d 'a=rec_new' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
-d 'type=A' \
-d 'name=sub' \
-d 'content=1.2.3.4'
"request": {
"act": "rec_new",
"a": "rec_new",
"tkn": "8afbe6deadd4c97bb6e25",
"email": "",
"type": "A",
"name": "test",
"content": "96.126.126.36",
"ttl": "1",
"service_mode": "1"
"response": {
"rec_id": "",
"rec_tag": "b3db8b8ad50389eb4abaef",
"zone_name": "",
"name": "",
"display_name": "test",
"type": "A",
"prio": null,
"content": "96.126.126.36",
"display_content": "96.126.126.36",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": "12805",
"ssl_status": "V",
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "0",
"props": {
"proxiable": 1,
"cloud_on": 0,
"cf_open": 1,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0,
"vanity_lock": 0
"result": "success",
"msg": null
Edit a DNS record for a zone. The record will be updated to the data passed through arguments here.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
Type of DNS record. Values include: [A/CNAME/MX/TXT/SPF/AAAA/NS/SRV/LOC]
DNS Record ID. Available by using the rec_load_all call.
Name of the DNS record.
The content of the DNS record, will depend on the the type of record being added
TTL of record in seconds. 1 = Automatic, otherwise, value must in between 120 and 86400 seconds.
"service_mode"[applies to A/AAAA/CNAME]
Status of CloudFlare Proxy, 1 = orange cloud, 0 = grey cloud.
"prio"[applies to MX/SRV]
MX record priority.
"service"[applies to SRV]
Service for SRV record
"srvname"[applies to SRV]
Service Name for SRV record
"protocol"[applies to SRV]
Protocol for SRV record. Values include: [_tcp/_udp/_tls].
"weight"[applies to SRV]
Weight for SRV record.
"port"[applies to SRV]
Port for SRV record
"target"[applies SRV]
Target for SRV record
Here is an example POST to the rec_edit action to edit an A record :
curl /api_json.html \
-d 'a=rec_edit' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'id=9001' \
-d 'email=' \
-d 'type=A' \
-d 'name=sub' \
-d 'content=1.2.3.4' \
-d 'service_mode=1' \
-d 'ttl=1'
"request": {
"act": "rec_edit",
"a": "rec_edit",
"tkn": "d48a6cfdddc",
"email": "",
"type": "A",
"name": "sub",
"content": "96.126.126.36",
"ttl": "1",
"service_mode": "1"
"response": {
"rec_id": "",
"rec_tag": "b3db8b8ad50389eb4abaef",
"zone_name": "",
"name": "",
"display_name": "sub",
"type": "A",
"prio": null,
"content": "96.126.126.36",
"display_content": "96.126.126.36",
"ttl": "1",
"ttl_ceil": 86400,
"ssl_id": "12805",
"ssl_status": "V",
"ssl_expires_on": null,
"auto_ttl": 1,
"service_mode": "1",
"props": {
"proxiable": 1,
"cloud_on": 1,
"cf_open": 0,
"expired_ssl": 0,
"expiring_ssl": 0,
"pending_ssl": 0,
"vanity_lock": 0
"result": "success",
"msg": null
Delete a record for a domain.
Requires the basic parameters described in
of this document. In addition you must pass the following parameters:
The target domain
DNS Record ID. Available by using the rec_load_all call.
Here is an example POST to the rec_delete action to edit A DNS record :
curl /api_json.html \
-d 'a=rec_delete' \
-d 'tkn=8afbe6deadd4c97bb6e25' \
-d 'email=' \
-d 'id=9001'
"request": {
"act": "rec_delete",
"a": "rec_delete",
"tkn": "d48a6cfdddc",
"email": "",
"result": "success",
"msg": null
Copyright & 2012 CloudFlare, Inc. All rights reserved.

我要回帖

更多关于 cloudflare.com 的文章

 

随机推荐