Hack around a problem with CORS headers on 404 responses (see comment in code)