sillygod / cdp-cache

a caddy 2 proxy cache plugin
MIT License
120 stars 18 forks source link

Fixed header "Content-Length: 0" #37

Closed flottes closed 3 years ago

flottes commented 3 years ago

The header "Content-Length: 0" causes problems in Firefox and curl (curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1) or Firefox doesn't download the content).

The "backends.Backend.Length()" function can only return 0, so maybe it can be removed completely.

sillygod commented 3 years ago

@flottes, hi how did you trigger this error?

flottes commented 3 years ago

The error occurs when the upstream server responds without a "Content-Length" header. The cache server then adds "Content-Length: 0", which causes the problem.