#30582: Redirect by using 307/308 instead of 310/302
-------------------------------------+-------------------------------------
               Reporter:  Yoshiki    |          Owner:  nobody
  Shibukawa                          |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  HTTP       |        Version:  master
  handling                           |
               Severity:  Normal     |       Keywords:  redirect statuscode
           Triage Stage:             |      Has patch:  1
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Now, Django uses 301/302 to redirect. This status codes' behaviors are
 undefined because of historical reason.
 RFC-7231 and RFC-7238 introduce new status code 307/308 for more strict
 usage. These status codes don't allow changing method during redirection.

 If Django users mistake form POST URL (and if the URL doesn't end with
 "/"), Django returns 301 to redirect new URL with trailing slash. But
 common browsers change method and send GET request to the new URL. Then
 user gets weird status code "405 Method Not Allowed" with GET. If Django
 uses 308 instead 301, users will get more meaningful status code like 404
 or 201 (if trailing slash would be collect).

 Unfortunately, Only IE 11 on Windows 7/8/8.1 don't support 307/308 now
 (IE11 on Windows 10 supports). And Windows 8.1 lives until 2023. So I made
 patch that checks user-agent and return 307/308 or 301/302.

 * [https://stackoverflow.com/questions/42703671/which-browsers-
 support-307-308-redirects-and-how-do-they-handle-them?rq=1 307/308 Browser
 Support on stack overflow]
 * [https://gist.github.com/shibukawa/52502ceb5462b6bf6ea6c5704be6659b My
 Patch]

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30582>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.777f77445728e3dc193dc6dd88ecbef8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to