HEAD response without Content-Length gets "Transfer-Encoding: chunked"
@NghiaTranUIT is already working on this.
Since Oct 28, 2026.
Assessment
This issue has not been assessed yet.
Description
Description
When a server answers an HTTP/1.1 HEAD request without a Content-Length header (valid, since a HEAD response never has a body), Proxyman forwards the response with an added transfer-encoding: chunked header and then writes the chunked terminator 0\r\n\r\n onto the connection.
A HEAD response must not carry a body (RFC 9110 §9.3.2, RFC 9112 §6.3), so the client correctly reads only the headers and leaves those 5 bytes in the socket. When it reuses the keep-alive connection for its next request, it reads 0\r\n\r\n where the next status line should be and fails. Proxyman shows that next request as 999 Error, and the app reports a network error.
This affects any app using HEAD requests, e.g. Supabase/PostgREST count queries, which supabase-swift and supabase-kt send as HEAD. Whichever request follows the HEAD on the same connection fails randomly, but only while Proxyman is in the path.
Steps to Reproduce
- Use any HTTP/1.1 server whose HEAD response has no
Content-Length. Ours is PostgREST 14.4 behind Kong 2.8.1 (a local Supabase stack on127.0.0.1:54321). - Through the Proxyman proxy (
127.0.0.1:9090), send a HEAD request on a keep-alive connection, e.g. with this raw-socket script (Python 3, no libraries):
import socket
s = socket.create_connection(("127.0.0.1", 9090))
s.sendall((
"HEAD http://127.0.0.1:54321/rest/v1/app_config?select=platform HTTP/1.1\r\n"
"Host: 127.0.0.1:54321\r\n"
"apikey: <anon key>\r\n"
"Authorization: Bearer <anon key>\r\n"
"Prefer: count=exact\r\n"
"Connection: keep-alive\r\n\r\n").encode())
print(s.recv(65536))
- Compare the raw bytes with the same request sent directly to the server (
127.0.0.1:54321, origin-form path). - Send any second request on the same proxied connection. With a real HTTP client (OkHttp/Ktor on Android, URLSession on iOS), that second request fails.
Current Behavior
Through Proxyman, the HEAD response gains a header and a body:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Content-Range: 0-1/2
...
transfer-encoding: chunked <- added by Proxyman
0\r\n\r\n <- added by Proxyman (a body on a HEAD response)
The next request on that connection fails immediately. Proxyman logs it as 999 Error with no response. The client sees a lost connection: Android (OkHttp/Ktor) gets a request failure, and iOS URLSession gets NSURLErrorNetworkConnectionLost (-1005). A retry on a fresh connection succeeds. It reproduces every time.
Expected Behavior
The HEAD response is forwarded exactly as the server sent it. Directly against the server it is:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Content-Range: 0-1/2
...
There is no Transfer-Encoding header and no bytes after the headers, so the next request on the connection works.
Environment
- App version: Proxyman 26.3.0 (build 260300)
- Dominant language
- No language data
- Stars
- 7.1k
- Forks
- 238
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ProxymanApp/Proxyman
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 52/100
ProxymanApp/Proxyman#2821 ·
-
Could not observe system extension changesPossibly taken @NghiaTranUIT claimed this 2 days ago. Open
Difficulty 4/5 1-2 days Newbie friendliness 45/100
ProxymanApp/Proxyman#2819 · 2 comments · 1 assignee ·
-
启动后约 6 秒崩溃Possibly taken @NghiaTranUIT claimed this 8 days ago. Open✅ Done bug
ProxymanApp/Proxyman#2818 · 2 comments · 1 assignee ·
-
[iPadOS] Local VPN toggle does not turn on and VPN profile is not created in iPadOS SettingsPossibly taken @NghiaTranUIT claimed this 9 days ago. Openbug
ProxymanApp/Proxyman#2817 · 1 comment · 1 assignee ·
-
Factory Reset in proxyman-cliPossibly taken @NghiaTranUIT claimed this 8 days ago. Open✅ Done enhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
ProxymanApp/Proxyman#2816 · 1 comment · 1 assignee ·