相关疑难解决方法(0)

可以使用Cloudflare缓存和保护REST API吗?

我正在设计一个RESTful API,旨在供单页应用程序和本机移动应用程序使用.此API的某些调用会返回可以缓存一段时间的公开结果.此外,需要速率保护来保护API免受未经授权的用户(蜘蛛)

我可以使用Cloudflare为我的RESTful API实现缓存和速率限制/ DDOS保护吗?

缓存: Cloudflare 支持HTTP缓存控制头,因此API可以决定通过GET请求的每个实体是否公开以及缓存多长时间.

  • 但是,目前尚不清楚缓存控制头是否也下游传递给客户端,因此还会触发浏览器缓存响应?这可能是不可取的,因为它可能使故障排除更加困难
  • Akamai有一个Edge-Control标头,可确保内容缓存在CDN中而不是浏览器中.可以用Cloudflare做类似的事吗?

DDOS保护: Cloudflare支持有一篇文章建议对后端API禁用DDOS保护,但这不适用于我的用例,即每个客户端应该向API发出少量请求.本机DDOS保护实际上符合我保护API免受机器人攻击的要求.

  • 我需要知道如何以编程方式检测Cloudflare何时服务于Captcha/我受到攻击等页面这将允许SPA /移动应用程序智能地做出反应,并将用户重定向到Web视图,在那里她可以演示她" hummanness".

  • 从Cloudflare文档中,显示DDOS质询时发送的HTTP状态代码并不明显.绕过Cloudflare DDOS保护的开源云计算器似乎表明Captcha和挑战页面的HTTP状态为200. 有没有比解析请求体更好的方法来确定是否启动了DDOS保护?

  • Cloudflare 显然使用cookie记录谁成功解决了Captcha.这显然会增加本机应用程序的额外复杂性.在挑战解决后,有没有一种方法可以将Cloudflare会话cookie转移回本机应用程序?

可能这是一个先进的Cloudflare用例 - 但我认为它很有前途,并且很高兴听到有人有这样的经历(在Cloudflare或其他CDN上).

rest caching ddos cloudflare single-page-application

33
推荐指数
3
解决办法
8599
查看次数

curl:由于 CloudFlare,无法从网站获取 rss

我值得注意的是在服务器上使用 curl连接这个站点http://www.youm7.com/newtkarirrss.asp

但我可以从本地主机访问它没有任何问题

这是测试

http://www.tjreb.com/xml_grabber.php?feed=http://www.youm7.com/newtkarirrss.asp&stack=1

试试 CNN RSS 提要

http://www.tjreb.com/xml_grabber.php?feed=http://rss.cnn.com/rss/edition_meast.rss&stack=0

我怎样才能绕过这个错误

这是我的源代码

<?php
  class xml_grabber
        {
            private $xml_file       = '' ;
            private $xml_link       = '' ;
            private $xml_dom        = '' ;
            private $xml_type       = '' ;
            private $xml_content    = '' ;
            private $xml_errors     = array() ;
            public  $xml_stack      = 0  ;

            public function __construct($link_file_com = '')
                   {
                       if(!$link_file_com)
                            {
                              $this->xml_errors['construct'] = 'No Xml In Construct' ;
                              return false;
                            }
                       elseif(!function_exists('simplexml_load_file') || !function_exists('simplexml_load_string') || !function_exists('simplexml_import_dom'))
                            {
                              $this->xml_errors['functions'] = …
Run Code Online (Sandbox Code Playgroud)

php xml-parsing rss-reader cloudflare

5
推荐指数
1
解决办法
2万
查看次数