diff --git a/netbox/utilities/middleware.py b/netbox/utilities/middleware.py index b9c95fc5e..64fb70a07 100644 --- a/netbox/utilities/middleware.py +++ b/netbox/utilities/middleware.py @@ -4,7 +4,7 @@ import sys from django.conf import settings from django.db import ProgrammingError -from django.http import HttpResponseRedirect +from django.http import Http404, HttpResponseRedirect from django.shortcuts import render from django.urls import reverse @@ -61,6 +61,10 @@ class ExceptionHandlingMiddleware(object): if settings.DEBUG: return + # Ignore Http404s (defer to Django's built-in 404 handling) + if isinstance(exception, Http404): + return + # Determine the type of exception if isinstance(exception, ProgrammingError): template_name = 'exceptions/programming_error.html'