Keep Alive Connection ESP32 Please Help

Hello Everyone,

I have an esp32 sending data to my server. The server is accepting the data and giving the following response:

17:07:00.770 -> +CIPRXGET: 2,0,273,0
17:07:00.770 -> HTTP/1.1 200 OK
17:07:00.770 -> Connection: Keep-Alive
17:07:00.770 -> Keep-Alive: timeout=5, max=100
17:07:00.770 -> x-powered-by: PHP/8.0.28
17:07:00.770 -> content-type: text/html; charset=UTF-8
17:07:00.770 -> content-length: 0
17:07:00.770 -> date: Fri, 25 Aug 2023 21:06:58 GMT
17:07:00.770 -> server: LiteSpeed
17:07:00.770 -> platform: hostinger

My question is, I want to change the values of 5 and 100 in the keep alive section. I logged in and didn't have a .htacess file so I made one and put the code below:

<IfModule mod_headers.c>
  Header set Connection keep-alive
  Header set Keep-Alive "timeout=10, max=10000"
</IfModule>

This changed my output, but didn't change the 5 and 100 values. How can I fix this? My new output is below:

17:07:00.770 -> HTTP/1.1 200 OK
17:07:00.770 -> Connection: Keep-Alive
17:07:00.770 -> Keep-Alive: timeout=5, max=100
17:07:00.770 -> x-powered-by: PHP/8.0.28
17:07:00.770 -> content-type: text/html; charset=UTF-8
17:07:00.770 -> content-length: 0
17:07:00.770 -> date: Fri, 25 Aug 2023 21:06:58 GMT
17:07:00.770 -> server: LiteSpeed
17:07:00.770 -> platform: hostinger
17:07:00.770 -> keep-alive: timeout=10, max=100000

This weird because if we look at the second outputs you gave, we can see that there is a line at the end with your parameters!
Or almost your parameters since max is equal to 100000 and not 10000 as in the file you gave us
Can you double check the output pls?

However, I don't know if this is relevant but there is a capital 'K' and 'A' at "Keep-Alive"
And as far as I know, this is the server that fixes the timeout. If the server is capable to have a dynamic timeout, then in the header of the response you should have something like

Access-Control-Allow-Headers: accept,DNT,,Keep-Alive,User-Agent....... //and so on

Something with all the headers accepted

Case matters. A human might think those two lines are the same, but the HTTP standard does not.

1 Like

But even if it is changed to the same Case on the bottom, which one takes precedence?

I think that if you use the same case then there won't be two parameters but only one!

But for that you need that the server you are requesting to accepts this headers in requests

1 Like

@alandinho10 I suppose you have to change the code as follow:

<IfModule mod_headers.c>
  Header set Connection Keep-Alive
  Header set Keep-Alive "timeout=10, max=10000"
</IfModule>

Uppercase matters in HTML access or even server side scripts are, as mentioned before, I´m not sure if this is going to help it can also be both in lower case: keep-alive.
Greetings dingsken.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.