Limitations of live preview vs production


#1

I just tried the resolveOverride feature and discovered it doesn’t work in the script editor / live preview. But it works fine after pushing to a staging area. In addition to cookies not working in the live preview, it would be nice if the limitations of the live preview were documented somewhere.


#2

@dan42 Yeah, the preview is limited in a lot of ways. We should document, but also we’re working on making it better.

Currently the preview is served off of a randomized subdomain of cloudflareworkers.com. A new domain is used every time you update the script (in order to avoid confusion from caching).

The preview is served as a completely independent service from normal cloudflare infrastructure. This means it cannot do anything that a regular client couldn’t do. For example, it doesn’t know your origin server address; subrequests get sent to your site’s public address, which means they go through Cloudflare normally. This means if you have a script deployed to production already, then in preview you will see the effects of that script in addition to the script you are previewing.

Also, the settings in the “cf” property of a request are things that external clients would not be allowed to override directly, hence in preview they don’t work.

We hope to fix this by integrating the preview more closely with CF infrastructure, e.g. so that you can preview a script on your real domain and without these quirks. Of course, we need to make sure other people can’t exploit this to bypass your live scripts, so we have to think carefully about security.