You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
APPEND_SLASH does double duty. It generates redirects for requests lacking a trailing slash. It also adds a slash to target urls. That's often what you want, but it makes it impossible to handle those redirects upstream.
So, in my case, I have a site that I want to resolve only slash-appended urls (for seo). But I want to handle redirects upstream (in a reverse proxy), so I set APPEND_SLASH=False. With that setting, non-slash-appended requests to cms pages resolve, instead of generating a 404. (Why do I want to do that? I want to fall back to an alternate site if the page does not exist in the cms).
In urls.py and util/urlutils.py, there are tests for APPEND_SLASH that add the slash.
I'd suggest separating those settings, so that
APPEND_SLASH - only controls redirects from middleware
REQUIRE_SLASH - sets url policy for the cms
To keep things backward-compatible, make the default
REQUIRE_SLASH=APPEND_SLASH
John
The text was updated successfully, but these errors were encountered:
The AppendSlash settings is very poorly tested, as it is used by very few users. I would accept a Pull Request for this. If you could find the time to write a test for this as well you would be my hero :)
APPEND_SLASH does double duty. It generates redirects for requests lacking a trailing slash. It also adds a slash to target urls. That's often what you want, but it makes it impossible to handle those redirects upstream.
So, in my case, I have a site that I want to resolve only slash-appended urls (for seo). But I want to handle redirects upstream (in a reverse proxy), so I set APPEND_SLASH=False. With that setting, non-slash-appended requests to cms pages resolve, instead of generating a 404. (Why do I want to do that? I want to fall back to an alternate site if the page does not exist in the cms).
In urls.py and util/urlutils.py, there are tests for APPEND_SLASH that add the slash.
I'd suggest separating those settings, so that
APPEND_SLASH - only controls redirects from middleware
REQUIRE_SLASH - sets url policy for the cms
To keep things backward-compatible, make the default
REQUIRE_SLASH=APPEND_SLASH
John
The text was updated successfully, but these errors were encountered: