Getting a 404 with redirected requests for APPEND_SLASH in logging middleware

I recently updated from django 3.2 to 4.2 and am getting a 404 in my logging middleware when a request gets a redirect on requests where APPEND_SLASH applies. My application has the APPEND_SLASH setting enabled and when I call curl -D - http://<host>/health, when /health/ is the correct path, curl correctly gets a 301 response but it gets passed to my custom logging middleware as a 404. In the past the redirect did not get passed to the middleware and these requests were not present in the logs.

I also checked and in django 4.1 it has the same behavior as in 3.2. What changed in 4.2 for this to happen? I cannot find any relevant information in the release notes.

If helpful, this is my list of middleware:

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'myapp.middleware.LoggingMiddleware'
]

Yes, this is now intentional.

See https://code.djangoproject.com/ticket/33700
and Fixed #33700 -- Skipped extra resolution for successful requests not … · django/django@fbac2a4 · GitHub