You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sidney Shek <ss...@atlassian.com> on 2014/09/23 07:07:56 UTC

[users@httpd] Apache 2.2 proxy dropping content-length header for HEAD responses where content-length is 0

Hello all,

We have an Apache 2.2 that we're using to proxy requests out to an
external service, and have noticed that for HEAD responses where the
content-length is 0, Apache seems to be dropping off the
content-length response header.

This is the verbose curl for the HEAD request when going direct to the service:
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> HEAD /blobstore/client/localhost/context/bar/blob/pdv-key HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8080
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Length: 0
Content-Length: 0
< ETag: da39a3ee5e6b4b0d3255bfef95601890afd80709
ETag: da39a3ee5e6b4b0d3255bfef95601890afd80709
< Connection: close
Connection: close

<
* Closing connection 0


This is the verbose curl for the HEAD request when going through the
Apache proxy (vhost that forwards requests to port 8108 to
localhost:8080):

* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8108 (#0)
> HEAD /blobstore/client/localhost/context/bar/blob/pdv-key HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8108
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Tue, 23 Sep 2014 04:57:19 GMT
Date: Tue, 23 Sep 2014 04:57:19 GMT
< ETag: da39a3ee5e6b4b0d3255bfef95601890afd80709
ETag: da39a3ee5e6b4b0d3255bfef95601890afd80709
< Content-Type: text/plain
Content-Type: text/plain

<
* Connection #0 to host localhost left intact

The latter response has a missing content-length.

Some observations:
- The content-length header is not dropped if the value is not zero.
- The content-length header is not dropped for GET requests even if
the value is zero.
- The service doesn't use chunked transfer encoding, and for a 0
length content nothing should be chunking.

While we're actually using 2.2.3, I've tested it on 2.2.29 compiled
with SSL, log-config, proxy, proxy-connect, and proxy-load-balancer on
an Ubuntu 14.04 instance with the same result. In terms of
configuration, I have just created a standard virtual host with a
ProxyPass. Also tried it with/without the proxy-sendcl environment
variable set with no difference. The config is below:

Listen 8108
NameVirtualHost *:8108

<VirtualHost *:8108>
    ServerName localhost
    SSLProxyEngine On
    ProxyPassInterpolateEnv On

LogFormat "%h %{X-Forwarded-For}i %u %t \"%r\" %>s %b %D
\"%{Referer}i\" \"%{User-Agent}i\"" combined-timed
    CustomLog /usr/local/apache2/logs/proxy_log combined-timed

    <Location />
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
        Allow from ::1
    </Location>

    SetEnv proxy-sendcl 1
    ProxyPass /blobstore http://localhost:8080/blobstore max=100
retry=60 ttl=60 timeout=30

</VirtualHost>


It seems like this issue:
https://issues.apache.org/bugzilla/show_bug.cgi?id=18757 but that
should have been fixed a long time ago.

Any thoughts? Is this a known issue with a workaround or should I
raise a bug for it?

Regards,

Sidney

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org