Forum Moderators: phranque
i have
KeepAlive On
in my httpd.conf
but everytime i check headers of my pages, it says
Connection: close.
If i manually send headers
header("Connection: keep-alive");
header("keep-alive: timeout=15, max=100"); then checking headers gives the following:
Connection: keep-alive, close
keep-alive: timeout=15, max=100
there must be some reason why apache is sending connection: close headers? the funny thing is, on my dev server, which has identical config in every way - the correct keep-alive headers are being sent?
can anyone help?
i just ssh'd to the live server and did telnet localhost 80 then GET /index.html HTTP/1.0 - and still received a Connection: close header. (surely this would bypass any proxies?)
is there another way to test this?
many thanks
p.s. as a matter of interest the only website i have found which specifies the "Connection: keep-alive" is google.com. all other sites, including WW, show Connection: close headers
when i send the
Connection: keep-aliveheader separately in my script, the results are as above:
Connection: keep-alive, close
keep-alive: timeout=15, max=100
so the close is still being sent.
what i still don't understand is why the apache
KeepAlive Ondirective doesn't appear to be working?
p.s. the HTTP/1.1 returned a
HTTP/1.1 400 Bad Requestheader
Also can you post FULL headers that you get from server. Also note that keep-alive won't be enforced is Content-Length is not known -- this should cover your PHP script.
You are likely to be getting BadRequest result for HTTP/1.1 because you MUST specify Host header.
>> Do you talk to server via proxy or directly?
as far as i know, directly, but i don't know a way to test that?
The full headers from a webpage using a server header checker:
HTTP/1.1 200 OK
Date: Fri, 25 Mar 2005 18:17:39 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_gzip/1.3.26.1a mod_ssl/2.8.9 OpenSSL/0.9.6c
Last-Modified: Fri, 25 Mar 2005 17:49:00 GMT
ETag: "526112431a2591c9965a410c8b28ab26"
Connection: close
Content-Type: text/html; charset=iso-8859-1
Content-Encoding: gzip
Content-Length: 4553
(i specifically send content length header in the php scripts).
here are the full headers from telnet localhost 80
GET / HTTP/1.1
Host:www.mysite.com
HTTP/1.1 200 OK
Date: Fri, 25 Mar 2005 18:12:55 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_gzip/1.3.26.1a mod_ssl/2.8.9 OpenSSL/0.9.6c
Last-Modified: Fri, 12 Nov 2004 10:25:53 GMT
ETag: "5c8019-1f3-41948fb1"
Accept-Ranges: bytes
Content-Length: 499
Content-Type: text/html; charset=iso-8859-1
does this shed any light on the matter?
many thanks
EDIT: Lord majestic, panic over. i can now see the keep alive headers
Status: HTTP/1.1 200 OK
Date: Fri, 25 Mar 2005 18:21:33 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_gzip/1.3.26.1a mod_ssl/2.8.9 OpenSSL/0.9.6c
Last-Modified: Fri, 25 Mar 2005 18:19:28 GMT
ETag: "83651502de4d7d357dc0bd9ae2be2a51"
Content-length: 14145
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
i used brett's server headers checker instead of the firefox view response headers, and as you can see above, the keep alives are working fine.
apologies for the confusion!