#3489·gluetun

Bug: HTTP proxy CONNECT response includes Transfer-Encoding: chunked, breaking FFmpeg

Author: st0o0Created Sep 26, 2026Updated Sep 28, 2026

Is this bug present on the latest image (:master branch)?

Yes

Is this bug present on the last stable image?

Yes

Host OS

Windows 11 Pro

CPU arch

x86_64

VPN service provider

AirVPN

What are you using to run the container

docker-compose

What's the problem

The built-in HTTP proxy's CONNECT response includes a Transfer-Encoding: chunked header. Per RFC 7231 Section 4.3.6, a successful CONNECT response establishes a tunnel and must not include transfer-encoding.

While curl correctly ignores this (Ignoring Transfer-Encoding in CONNECT 200 response), FFmpeg's httpproxy handler interprets the chunked encoding literally, reads the "last chunk", closes the connection, and the TLS handshake fails with [tls] IO error.

curl verbose output showing the invalid header:

CONNECT httpbin.org:443 HTTP/1.1 < HTTP/1.1 200 OK < Transfer-Encoding: chunked

  • Ignoring Transfer-Encoding in CONNECT 200 response

FFmpeg debug output: [tcp] Successfully connected to 127.0.0.1 port 8888 [tls] Info method=SSL_connect state=TWCH(SSLv3/TLS write client hello) [httpproxy] Last chunk received, closing conn [tls] IO error: Input/output error

Root cause in internal/httpproxy/https.go: responseWriter.WriteHeader(http.StatusOK) is called before hijacker.Hijack(). Go's net/http ResponseWriter automatically adds Transfer-Encoding: chunked when no Content-Length is set.

Suggested fix - write the 200 response manually after hijacking: hijacker, ok := responseWriter.(http.Hijacker) if !ok { http.Error(responseWriter, "Hijacking not supported", http.StatusInternalServerError) return } clientConnection, _, err := hijacker.Hijack() if err != nil { // ...error handling... } clientConnection.Write([]byte("HTTP/1.1 200 Connection Established\r\n\r\n"))

Share your logs (at least 10 lines). Share the version string logged at the beginning PLEASE!!

plain
========================================
=============== gluetun ================
========================================
Running version latest built on 2026-09-23T23:02:31.234Z (commit 1267bae)
[...]
├── HTTP proxy settings:
|   ├── Enabled: yes
|   ├── Listening address: :8888
|   ├── Read header timeout: 1s
|   └── Read timeout: 3s
[...]
[http proxy] listening on :8888
[wireguard] Connecting to 37.120.155.178:1637
[vpn] wireguard setup is complete.
[ip getter] Public IP address is 37.120.155.179 (Austria)
[http proxy] 127.0.0.1:53760 <-> httpbin.org:443

Share your configuration

yaml
gluetun:
  image: qmcgaw/gluetun
  cap_add:
    - NET_ADMIN
  devices:
    - /dev/net/tun:/dev/net/tun
  environment:
    - VPN_SERVICE_PROVIDER=airvpn
    - VPN_TYPE=wireguard
    - WIREGUARD_PRIVATE_KEY=<redacted>
    - WIREGUARD_ADDRESSES=10.x.x.x/32
    - SERVER_COUNTRIES=Austria
    - HTTPPROXY=on
    - HTTPPROXY_LOG=on

Reproduction:
# curl works
docker run --rm --network container:gluetun curlimages/curl \
  -x http://127.0.0.1:8888 https://httpbin.org/ip

# FFmpeg fails
docker run --rm --network container:gluetun linuxserver/ffmpeg \
  -http_proxy http://127.0.0.1:8888 \
  -i "https://httpbin.org/get" -t 1 -f null /dev/null