Hello, I'm struggling with some software of questionable quality (UniFi Controller) which generally works behind Traefik, but when you try to download a backup file the response from the backend has the Content-Length
header set to some apparently random negative value. This obviously violates the spec, content length if present must be a positive integer or 0, but as usual browsers don't enforce that and the download goes through albeit with no progress bar. Traefik however does what is probably the right thing and throws 500 Internal Server Error
.
Sample debug log:
reverse-proxy_1 | time="2021-07-16T14:17:29Z" level=debug msg="'500 Internal Server Error' caused by: net/http: HTTP/1.x transport connection broken: bad Content-Length \"-1963422688\""
reverse-proxy_1 | time="2021-07-16T14:17:29Z" level=debug msg="vulcand/oxy/roundrobin/rr: completed ServeHttp on request" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/dl/autobackup/autobackup_6.2.26_20210716_0500_1626411600025.unf\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\",\"RawFragment\":\"\"},\"Proto\":\"HTTP/2.0\",\"ProtoMajor\":2,\"ProtoMinor\":0,\"Header\":{\"Accept\":[\"*/*\"],\"Accept-Encoding\":[\"gzip, deflate, br\"],\"Accept-Language\":[\"en-US,en;q=0.5\"],\"Cookie\":[\"unifises=[REDACTED]; csrf_token=[REDACTED]\"],\"Referer\":[\"https://unifi.[REDACTED].com:8443/manage/site/givqab4c/settings/backup\"],\"Te\":[\"trailers\"],\"User-Agent\":[\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0\"],\"X-Forwarded-Host\":[\"unifi.[REDACTED].com:8443\"],\"X-Forwarded-Port\":[\"8443\"],\"X-Forwarded-Proto\":[\"https\"],\"X-Forwarded-Server\":[\"4153a08587b0\"],\"X-Real-Ip\":[\"10.42.10.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"unifi.[REDACTED].com:8443\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"10.42.10.1:40423\",\"RequestURI\":\"/dl/autobackup/autobackup_6.2.26_20210716_0500_1626411600025.unf\",\"TLS\":null}"
So what I need is to have Traefik ignore the invalid negative Content-Length
and either pass it through or remove the header as it's not required as far as I can tell. Also submit a bug to Ubiquity but I have no faith that it will be fixed within the next few years. Thanks.