Staticache not working on posts

I’ve just gone to write a new post, but I can no longer preview drafts, I get a 404. I assume it’s something to do with the edited route. Here’s what it looks like:

// Make the non /blog/ URLs work
        [
            'pattern' => '(:any)',
            'action'  => function($uid) {
                $page = page($uid);
                if(!$page) $page = page('blog/' . $uid);
                if(!$page) $page = site()->errorPage();
                return site()->visit($page);
            }
        ],
        [
            'pattern' => 'blog/(:any)',
            'action'  => function($uid) {
                go($uid);
            }
        ],

Is there something I can do to exclude drafts from this route, or (better yet) include them in it?

Tried this solution but it didn’t work for me.

Thanks.