[Solved] server keep alive not working

#1
Hello,

We are encountering an issue with the Litespeed server Keep-Alive. We keep getting "Connection: close" responses, suggesting that keep-alive is not active.

Code:
user1@user1-PC:~$ curl -Iv http://www.myfirstdomain.com/
*   Trying 123.123.123.33...
* TCP_NODELAY set
* Connected to www.myfirstdomain.com (123.123.123.33) port 80 (#0)
> HEAD / HTTP/1.1
> Host: www.myfirstdomain.com
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"
P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"
< Powered-By: PrestaShop
Powered-By: PrestaShop
< Set-Cookie: PrestaShop-d74f8db6e0292aaf5484784dda7d7447=def5020010f4ad73d12015d1775b82a8d68a77a1e73b462dfd3e9dc76e51149b17f1cf58009f3d23d3324ae9da10aef8dcf74ffc09111737ec9af3886c13abb979ccdb90c006336208122487ad13a7bd19afaedf81ce68a30e066f676ad49e7bb91b6352ba2013ea0a55d0d889e528aebf0e3033aac1a23585be862f1e2140b497133918a71c0af0001b43c1dff7769d8ecef7478e889292eb8ea9e309925fb46e7f12f7ac74e76f23271ae2e78e6842cb2136b3d68a53cce51adec1af86d80433c9457723ab6dbed7a6; expires=Sun, 01-Apr-2018 09:25:53 GMT; Max-Age=1728000; path=/; domain=www.myfirstdomain.com; HttpOnly
Set-Cookie: PrestaShop-d74f8db6e0292aaf5484784dda7d7447=def5020010f4ad73d12015d1775b82a8d68a77a1e73b462dfd3e9dc76e51149b17f1cf58009f3d23d3324ae9da10aef8dcf74ffc09111737ec9af3886c13abb979ccdb90c006336208122487ad13a7bd19afaedf81ce68a30e066f676ad49e7bb91b6352ba2013ea0a55d0d889e528aebf0e3033aac1a23585be862f1e2140b497133918a71c0af0001b43c1dff7769d8ecef7478e889292eb8ea9e309925fb46e7f12f7ac74e76f23271ae2e78e6842cb2136b3d68a53cce51adec1af86d80433c9457723ab6dbed7a6; expires=Sun, 01-Apr-2018 09:25:53 GMT; Max-Age=1728000; path=/; domain=www.myfirstdomain.com; HttpOnly
< Set-Cookie: PHPSESSID=d2tedvq72keoiqluhcjvkjvk57; path=/
Set-Cookie: PHPSESSID=d2tedvq72keoiqluhcjvkjvk57; path=/
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
Pragma: no-cache
< Set-Cookie: PrestaShop-477ce455040fe766b9392db3bebe8030=def50200eefd0627a0f9ec10866dfe0086d38af32e254fcda29815934a7643de9e67430172dc345ba2942dc2a680916a5aed80410bd50a72c735a97386b137db4f0339f8d1d7aaaee93e81bf5dd4d989eaa8dbb455ada94b2fc85bea4aae174e1a24b11fd2ae52e797a69a6560783c5cbbd10365e69bffe7253aa6125862552ddc983c2f012ac6ac4a4ef02c333f4d323a85a6423304f1a81395f29399e0840624ca9f73bb6aa19640d1da8617e4378fa525ca8f65ad05e3c8bd; expires=Sun, 01-Apr-2018 09:25:53 GMT; Max-Age=1728000; path=/; domain=www.myfirstdomain.com; HttpOnly
Set-Cookie: PrestaShop-477ce455040fe766b9392db3bebe8030=def50200eefd0627a0f9ec10866dfe0086d38af32e254fcda29815934a7643de9e67430172dc345ba2942dc2a680916a5aed80410bd50a72c735a97386b137db4f0339f8d1d7aaaee93e81bf5dd4d989eaa8dbb455ada94b2fc85bea4aae174e1a24b11fd2ae52e797a69a6560783c5cbbd10365e69bffe7253aa6125862552ddc983c2f012ac6ac4a4ef02c333f4d323a85a6423304f1a81395f29399e0840624ca9f73bb6aa19640d1da8617e4378fa525ca8f65ad05e3c8bd; expires=Sun, 01-Apr-2018 09:25:53 GMT; Max-Age=1728000; path=/; domain=www.myfirstdomain.com; HttpOnly
< Set-Cookie: PrestaShop-477ce455040fe766b9392db3bebe8030=def50200ffdef0d8f0f9c30c3b63f71947b806cffff3a328a6e6d27773722bb7c1abc426fd54a0ae473f131ea58b6bbd6b70ebc34d267bab14ef0944dfddcf645a6c9991d071b1cd6c42435dad788256fbf8233e9392e9df03467dcd8d1346280ccb40af4ad2017a5a4c5b7987801edc473229adf0500e61b58ec63ce14906f0673d73861b32da073851dcf35c043ff71f8204500ab23050be467e2c8753134915d5cf2cd24bbcd22cf7287724d3ef2e9d133387f7c8e71cf6ec0ff22768b45775f6c9e7ceac4f014b9a73e19ff7815d282b1424134e0c3626f802d7081ac3; expires=Sun, 01-Apr-2018 09:25:53 GMT; Max-Age=1728000; path=/; domain=www.myfirstdomain.com; HttpOnly
Set-Cookie: PrestaShop-477ce455040fe766b9392db3bebe8030=def50200ffdef0d8f0f9c30c3b63f71947b806cffff3a328a6e6d27773722bb7c1abc426fd54a0ae473f131ea58b6bbd6b70ebc34d267bab14ef0944dfddcf645a6c9991d071b1cd6c42435dad788256fbf8233e9392e9df03467dcd8d1346280ccb40af4ad2017a5a4c5b7987801edc473229adf0500e61b58ec63ce14906f0673d73861b32da073851dcf35c043ff71f8204500ab23050be467e2c8753134915d5cf2cd24bbcd22cf7287724d3ef2e9d133387f7c8e71cf6ec0ff22768b45775f6c9e7ceac4f014b9a73e19ff7815d282b1424134e0c3626f802d7081ac3; expires=Sun, 01-Apr-2018 09:25:53 GMT; Max-Age=1728000; path=/; domain=www.myfirstdomain.com; HttpOnly
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< Date: Mon, 12 Mar 2018 09:25:53 GMT
Date: Mon, 12 Mar 2018 09:25:53 GMT
< Accept-Ranges: bytes
Accept-Ranges: bytes
< Server: LiteSpeed
Server: LiteSpeed
< Connection: close  
Connection: close  

<
* Curl_http_done: called premature == 0
* Closing connection 0

The site that we're testing on is a non SSL site. Running the same tests on a SSL site on the same server, it show the correct output with
Code:
* Connection #0 to host www.myotherdomain22.com left intact
as shown below.


Code:
user1@user1-PC:~$ curl -Iv https://www.myotherdomain22.com/
*   Trying 123.123.123.33...
* TCP_NODELAY set
* Connected to www.myotherdomain22.com (123.123.123.33) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: OU=Domain Control Validated; OU=PositiveSSL; CN=myotherdomain22.com
*  start date: Jul 10 00:00:00 2017 GMT
*  expire date: Jul 10 23:59:59 2018 GMT
*  subjectAltName: host "www.myotherdomain22.com" matched cert's "www.myotherdomain22.com"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Domain Validation Secure Server CA
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55ee0675cda0)
> HEAD / HTTP/1.1
> Host: www.myotherdomain22.com
> User-Agent: curl/7.52.1
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200
HTTP/2 200
< content-type: text/html; charset=UTF-8
content-type: text/html; charset=UTF-8
< link: <https://www.myotherdomain22.com/wp-json/>; rel="https://api.w.org/"
link: <https://www.myotherdomain22.com/wp-json/>; rel="https://api.w.org/"
< link: <https://www.myotherdomain22.com/>; rel=shortlink
link: <https://www.myotherdomain22.com/>; rel=shortlink
< etag: "4-1520844155;;;"
etag: "4-1520844155;;;"
< x-litespeed-cache: hit
x-litespeed-cache: hit
< date: Mon, 12 Mar 2018 09:24:00 GMT
date: Mon, 12 Mar 2018 09:24:00 GMT
< accept-ranges: bytes
accept-ranges: bytes
< server: LiteSpeed
server: LiteSpeed
< alt-svc: quic=":443"; ma=2592000; v="35,37"
alt-svc: quic=":443"; ma=2592000; v="35,37"

<
* Curl_http_done: called premature == 0
* Connection #0 to host www.myotherdomain22.com left intact
I'm also sending two printscreens with the headers from chrome and the settings from the Litespeed configuration interface.

Can someone help me solve this issue? is this working as it should?

Thank you.
 

Attachments

Last edited by a moderator:
#2
UPDATE:
Switching to Apache without modifying any of the settings seems to give the correct keep-alive response using the first domain that on Litespeed does not work:

Code:
user1@user1-PC:~$ curl -Iv http://www.myfirstdomain.com/
*   Trying 123.123.123.33...
* TCP_NODELAY set
* Connected to www.myfirstdomain.com (123.123.123.33) port 80 (#0)
> HEAD / HTTP/1.1
> Host: www.myfirstdomain.com
> User-Agent: curl/7.52.1
> Accept: */*
> 
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Mon, 12 Mar 2018 09:37:54 GMT
Date: Mon, 12 Mar 2018 09:37:54 GMT
< Server: Apache
Server: Apache
< P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"
P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"
< Powered-By: PrestaShop
Powered-By: PrestaShop
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
Pragma: no-cache
< Set-Cookie: PrestaShop-d74f8db6e0292aaf5484784dda7d7447=def50200fc9974fc06c0c85a980647ec1db34b9b8398d53e12bca7feea4a1e0a3d7663783c67897c8b25b4e2c0ac5949da24753676954f57153fba68038ee1561bfeb677c2e50488a73f502bdc9bac0ba0f353baddee123a1398618991fc86b870a9b2025875297342da14cfedd90ef94f9bd003b6061a719a8cb2ce429b4bfcfe22a29eb9df809c9d82855f6666d77c70a740ce1052e5f97c8fc5b0e1860cbf40c596f0376100f54cf4cb6a37a7bdaa9c9ecc4258ec547737cd43bcf278a2731504637d14369915611b; expires=Sun, 01-Apr-2018 09:37:55 GMT; Max-Age=1728000; path=/; domain=www.myfirstdomain.com; HttpOnly
Set-Cookie: PrestaShop-d74f8db6e0292aaf5484784dda7d7447=def50200fc9974fc06c0c85a980647ec1db34b9b8398d53e12bca7feea4a1e0a3d7663783c67897c8b25b4e2c0ac5949da24753676954f57153fba68038ee1561bfeb677c2e50488a73f502bdc9bac0ba0f353baddee123a1398618991fc86b870a9b2025875297342da14cfedd90ef94f9bd003b6061a719a8cb2ce429b4bfcfe22a29eb9df809c9d82855f6666d77c70a740ce1052e5f97c8fc5b0e1860cbf40c596f0376100f54cf4cb6a37a7bdaa9c9ecc4258ec547737cd43bcf278a2731504637d14369915611b; expires=Sun, 01-Apr-2018 09:37:55 GMT; Max-Age=1728000; path=/; domain=www.myfirstdomain.com; HttpOnly
< Set-Cookie: PHPSESSID=j8fauriobb44a8vl62tr9fneh0; path=/
Set-Cookie: PHPSESSID=j8fauriobb44a8vl62tr9fneh0; path=/
< Set-Cookie: PrestaShop-477ce455040fe766b9392db3bebe8030=def502001bbae07f8f5ea2115afed69de61adec4bc1565494b3711454ab60a04dba5ef59b1a29e29bd8c3dbb32a36dbede4a18a7dd54d1f604ef945ab762bd4c7bb487405228dbe9048741ef54069c6d78f633789a95f06fb99823dfc85a9a9dc3a924bde76999df1f8b4d1752566a7695ca4b8e0fa66e2f3414eeb24fff73f44a6067d2ed64ac33fa29a0c47abc20c84e4897b2c15b59090872bac48137eedb451564d6b13cb3895bb76927f6e40f7137f8e67c8c8a33f969318b; expires=Sun, 01-Apr-2018 09:37:54 GMT; Max-Age=1727999; path=/; domain=www.myfirstdomain.com; HttpOnly
Set-Cookie: PrestaShop-477ce455040fe766b9392db3bebe8030=def502001bbae07f8f5ea2115afed69de61adec4bc1565494b3711454ab60a04dba5ef59b1a29e29bd8c3dbb32a36dbede4a18a7dd54d1f604ef945ab762bd4c7bb487405228dbe9048741ef54069c6d78f633789a95f06fb99823dfc85a9a9dc3a924bde76999df1f8b4d1752566a7695ca4b8e0fa66e2f3414eeb24fff73f44a6067d2ed64ac33fa29a0c47abc20c84e4897b2c15b59090872bac48137eedb451564d6b13cb3895bb76927f6e40f7137f8e67c8c8a33f969318b; expires=Sun, 01-Apr-2018 09:37:54 GMT; Max-Age=1727999; path=/; domain=www.myfirstdomain.com; HttpOnly
< Set-Cookie: PrestaShop-477ce455040fe766b9392db3bebe8030=def502005d1d6d023f82d5d58b9e9141f5e5bc92bce28ffd457afc780977be7cc9faa639c45b57096e9aa107535517578c76602ff7aa4277c599f8431035e9bfd2eeda09ea0f927c24be29871885b9cb3d8533a9f4e0cb6deff2e6b4832a88ca5638fd44a281886d69cae4f9ff0b5a5dd1ae9a425d15df15b068786e2f374b7907f5bb66961f76612a8560015db28293db77b364ced747f25b1089099de5f4d3075f5df56850e657267afba7df14f4be6bd44c3a67d61f41a85282766d46a2c639e707334557b4ac4c5543b391be0b26180be3001cc1e57cb206d0a4666e16; expires=Sun, 01-Apr-2018 09:37:54 GMT; Max-Age=1727999; path=/; domain=www.myfirstdomain.com; HttpOnly
Set-Cookie: PrestaShop-477ce455040fe766b9392db3bebe8030=def502005d1d6d023f82d5d58b9e9141f5e5bc92bce28ffd457afc780977be7cc9faa639c45b57096e9aa107535517578c76602ff7aa4277c599f8431035e9bfd2eeda09ea0f927c24be29871885b9cb3d8533a9f4e0cb6deff2e6b4832a88ca5638fd44a281886d69cae4f9ff0b5a5dd1ae9a425d15df15b068786e2f374b7907f5bb66961f76612a8560015db28293db77b364ced747f25b1089099de5f4d3075f5df56850e657267afba7df14f4be6bd44c3a67d61f41a85282766d46a2c639e707334557b4ac4c5543b391be0b26180be3001cc1e57cb206d0a4666e16; expires=Sun, 01-Apr-2018 09:37:54 GMT; Max-Age=1727999; path=/; domain=www.myfirstdomain.com; HttpOnly
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8

< 
* Curl_http_done: called premature == 0
* Connection #0 to host www.myfirstdomain.com left intact
 
#3
Hello,

Managed to solve this by turning off Smart Keep-Alive feature. As stated in the documentation:

Smart keep-alive will only establish keep-alive connections for requests of JavaScript, CSS Style Sheet, and image files. For html pages, the connection will not be kept alive.
This probably led to some links not being served through a keep-alive connection.

Regards.
 
Top