Previously, I have used CloudFlare, where we can switch quickly between "active mode" and "development mode". In "development mode", static files are loaded directly from the origin server rather than from CDN nodes.

I'm now tying Qiniu CDN to speed up my website in China and oversee. From time to time I also want to load a file or the whole website from the origin server rather than the CDN to compare with the CDN mode and see the optimisation effect of the CDN. However, unlike CloudFlare, Qiniu does not have the quick switch button. So does anyone know if there are other ways to do so?

For example, when CDN is on, could anyone confirm that http://www.funfun.org.cn/1/#/home uses CDN, whereas the origin server does not?

This thread proposed to use -H 'Host: static.example.com', but I am not sure if it is relevant.

  • It really depends how your CDN works. One way that can be successful is putting the IP address of your server into the hosts file on your PC, to direct your PC to go directly to the origin. On a Windows PC if you want to be 100% sure you're going to the origin directly you can restart your PC or at an admin command prompt use "ipconfig /flushdns". – Tim Jun 10 '18 at 7:43
  • In Google Chrome, when CDN is on, does http://www.funfun.org.cn/1/#/home use CDN, whereas NOT? – Thomas Jun 10 '18 at 11:24

In your software, develop a toggle that switches the domain name of the CDN in each static document. For example, send cdn.example.net to your content delivery network of choice, but log in as your user and set some "no CDN" option and you get static.example.net, which resolves to the origin server.

A benefit of this approach is not requiring overriding name resolution, or dealing with DNS caches.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.