Show JS Challenge if page is not cached by cloudflare

my site is getting ddos. I want to show a JS Challenge if any path (page) is not cached by cloudflare.

i think i can do this with security custom rule but i am not getting the right expression.

am i doing right or is there any other approach?
Was this page helpful?