Showing native 404 page and not the custom 404 in some circumstances

I have a 404 page defined as follows. If I purposefully hit a non valid
page I see the custom 404 page. But sometimes due to rate limiting and
probably busy CPU I see the default nginx 404 page.

I can’t narrow this down to the precise reason, but I keep seeing this
every now and then. I don’t run a very powerful VM

How do I show the custom 404 always?

    error_page  404        = @errorpages;

    location @errorpages {

                root /var/www/prod/cucumbertown/templates/;

                internal;

                proxy_pass http://localhost:82;

                proxy_set_header   Host             $host;

                proxy_set_header   X-Real-IP        $remote_addr;

                proxy_set_header Accept-Encoding "";

                proxy_ignore_headers Set-Cookie;

                proxy_ignore_headers Cache-Control;

                proxy_ignore_headers Expires;

                proxy_ignore_headers X-Accel-Expires;

                add_header X-Cache-Status $upstream_cache_status;

                proxy_cache             jscss;

                proxy_cache_key         $request_uri;

        proxy_cache_use_stale   updating;

    }

-Quintin