However, the question was found since, according to the RFCs, a forward HTTP proxy may forward the "request-target" to the origin server. This leads the real client to get an error when accessing via an HTTP proxy.
I understand you, and I'd be happy to fix this behavior if core developer agrees.
But I think it's worth noting that "absolute-form" is typically used when making a request through an HTTP proxy, and http.server isn't a proxy - it's a basic file-serving web server.
and http.server isn't a proxy - it's a basic file-serving web server.
When I found this problem, I was using http.server as the origin server behind a proxy server, and I got 404 because the proxy server forwarded the "absolute-form".
Activity
donbarbos commented on Apr 20, 2025
it seems this is expected behavior, since if the request ends with a backslash, a 404 error is returned:
cpython/Lib/http/server.py
Lines 771 to 778 in 5d8e432
this was discussed here: #78892
donbarbos commented on Apr 20, 2025
you can use next command:
GreenYun commented on Apr 20, 2025
This is not expected. A "request-target" with trailing backslash is for listing the contents for a real directory.
Yes, this is correct.
However, the question was found since, according to the RFCs, a forward HTTP proxy may forward the "request-target" to the origin server. This leads the real client to get an error when accessing via an HTTP proxy.
donbarbos commented on Apr 20, 2025
I understand you, and I'd be happy to fix this behavior if core developer agrees.
But I think it's worth noting that "absolute-form" is typically used when making a request through an HTTP proxy, and http.server isn't a proxy - it's a basic file-serving web server.
cc @picnixz
GreenYun commented on Apr 24, 2025
When I found this problem, I was using http.server as the origin server behind a proxy server, and I got 404 because the proxy server forwarded the "absolute-form".