Tell if in Worker is in Preview

Is there a way to tell if the current request is being handled in Worker Preview mode, i.e. the quick edit console?

Since Cache is not implemented in preview and all operations are just no-ops it makes it hard to debug. If I can know the script is in preview mode I can set a variable to use my own cache simulator (which is just a thin wrapper around Map with some validation and Request/Response cloning).

For this I use a two different scripts outside Quick Edit with dev and production environments:

Two branches in git main and dev.

Thanks … workable … although I hate having different dev and prod builds … been bitten one to many times!

You could block access to dev using cloudflare access.