Add middleware and 404 page