Re: Apache dropping content-length response header from reverse proxy

Erik Thuning <[email protected]> Wed, 23 Apr 2025 14:21:43 +0200
Newsgroups gmane.comp.apache.user
Message-ID <[email protected]>
On 2025-04-23 14:16, Rainer Canavan wrote:
> > From: Erik Thuning <[email protected]>
> [...]
>
> > I have an apache server running as reverse proxy for a tomcat
> > application using mod_proxy_ajp. An external application pulling data
> > from mine has a hard requirement to get a content-length header in the
> > response and won't accept transfer-encoding=chunked. Tomcat is setting
> > content-length as expected, but apache replaces it with
> > transfer-encoding=chunked in its response.
>
> > How can I make apache stop switching these headers (and presumably stop
> > streaming the response)? Preferrably only for a specified path
> > (/divaexport), since the application is large and only a tiny portion
> > has this content-length requirement.
>
> Since chunked encoding is an integral part of HTTP/1.1, try setting 
> downgrade-1.0 and/or force-response-1.0 using BrowserMatch if possible 
> (see https://httpd.apache.org/docs/2.4/env.html), but I'm not sure if 
> that will result a Content-Length header or a simple Connection: close 
> in this case. If you really need the Content-Length, mod_buffer may be 
> useful.
>
> Rainer

Downgrading only results in Connection: close unfortunately. I'll look 
into mod_buffer, thanks!

/T