This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: HTTPRedirectHandler fails on POST for 307 and 308
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Jairo Llopis, corona10, orsenthil
Priority: normal Keywords:

Created on 2022-03-29 09:26 by Jairo Llopis, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg416249 - (view) Author: Jairo Llopis (Jairo Llopis) Date: 2022-03-29 09:26
urllib.request.HTTPRedirectHandler fails if there is a 307 HTTP return code in a POST request.

In the same behaviour was implemented for 308.

According to IMHO this implementation is wrong for 308:

> Note: This status code is similar to 301 (Moved Permanently)
> ([RFC7231], Section 6.4.2), except that it does not allow changing
> the request method from POST to GET.

A similar note exists in regarding code 307.

So, as long as the original redirection is in POST and it gets redirected to another POST, it should not be an error.

FWIW, in you can see that Traefik proxy uses 307 and 308 codes by default when redirecting non-GET requests.

Thus, urllib.request.HTTPRedirectHandler will fail to process any POST requests proxied by Traefik.
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91306
2022-03-31 00:07:30ned.deilysetnosy: + orsenthil
2022-03-29 14:48:44corona10setnosy: + corona10
2022-03-29 09:26:11Jairo Llopiscreate