Skip to content

Commit

Permalink
Update note about APPEND_SLASH
Browse files Browse the repository at this point in the history
In Django 4.2, the redirect only happens in `process_response`, so Wagtail kicks in first.
  • Loading branch information
RealOrangeOne committed Mar 1, 2024
1 parent 71082cc commit 757f992
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions text/093-redirect-improvements.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* RFC: 93
* Author: Jake Howard
* Created: 2024-02-22
* Last Modified: 2024-02-22
* Last Modified: 2024-03-01

## Meta Abstract

Expand Down Expand Up @@ -55,7 +55,7 @@ However, this also means redirects happen much later than may be expected. To ma

An `is_eager` column will be added to a `Redirect`, which flags whether the redirect should run before the rest of the Wagtail page process, or afterwards (as they would currently). `is_eager` will default to `False`, to ensure it's not a breaking change, or impact other site behaviours.

To properly support `is_eager`, the `RedirectMiddleware` will also need bringing up the `MIDDLEWARES` list, below incredibly high middleware such as `SecurityMiddleware`, `GzipMiddleware` and `WhitenoiseMiddleware`, but still as high as possible. For redirects to apply before Django's `APPEND_SLASH` functionality, and thus keep the redirect chains short, the `RedirectMiddleware` must come before `CommonMiddleware`.
To properly support `is_eager`, the `RedirectMiddleware` will also need bringing up the `MIDDLEWARES` list, below incredibly high middleware such as `SecurityMiddleware`, `GzipMiddleware` and `WhitenoiseMiddleware`, but still as high as possible. Unfortunately, this will impact performance, as a database query will need to be made for redirects on every request.

A Django check will be added to warn users when `RedirectMiddleware` is placed below `CommonMiddleware`.

Expand Down

0 comments on commit 757f992

Please sign in to comment.