#23531: APPEND_SLASHES behavior shouldn't redirect with a 301
------------------------------+------------------------------------------
     Reporter:  mattrobenolt  |      Owner:  nobody
         Type:  Bug           |     Status:  new
    Component:  Core (URLs)   |    Version:  master
     Severity:  Normal        |   Keywords:  common, middleware, redirect
 Triage Stage:  Unreviewed    |  Has patch:  1
Easy pickings:  0             |      UI/UX:  0
------------------------------+------------------------------------------
 Redirecting with a permanent redirect (HttpResponsePermanentRedirect) can
 lead to 404s and other unexpected behavior when things move around.

 For example:

 In settings.py, `APPEND_SLAHSES = True` (the default behavior)

 In urls.py `url(r'foo/$', ..._`

 A user visits `example.com/foo` and gets redirected to `example.com/foo/`
 as expected.

 Later, we decide that we don't like slashes in our urls, and change to
 `APPEND_SLASHES = False` and change our url route to `url(r'foo$', ...`

 A user visits `example.com/foo` again (which is now the correct url) and
 their browser redirects them to `example.com/foo/` which is now a 404.

 This behavior happens specifically because Django has told it that this
 redirect is 100% going to happen, so the browser caches it and doesn't ask
 the server again. In my opinion, it's a bad idea that Django makes this
 assumption because it has no insight into what future plans are and
 whatnot.

 This behavior has also existed since at least 2007, so I'm not sure how
 much effort needs to go into changing this moving forward for 1.8+.

--
Ticket URL: <https://code.djangoproject.com/ticket/23531>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.fb0c7cd42cca1cf2f0bf9700b4517820%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to