Return error code 404 (Not found) for blocked resources in production mode.

In dev mode return 500 so the user can see the error displayed on the screen and fix it